While (rs. next ()){
Count ++;
String ip = rs. getString ("ip ");
Int port = rs. getInt ("port ");
String type = rs. getString ("type ");
LOG. debug (count + "get" + type + "proxy:" + ip + ":" + port );
Try {
CheckSocksProxy (ip, port, type );
} Catch (Throwable e ){
LOG.info ("check error,", e );
}
}
I am not saying that it is not good to use jdbc directly. In some special business scenarios, only one data fetch operation is required, and the data is retrieved every hour or day. You can simply use jdbc to simplify the operation.
However, the checkSocksProxy operation is performed when the connection is not released in the result set. This operation takes several hours, and the database connection is occupied by the entire checkSocksProxy.
If it is released, the database will be immediately dragged to death.
When there is no orm tool in the past, we will directly import it to CacheedResultSet to release the connection immediately, and then slowly access CacheedResultSet. Now the orm framework is so mature that each data request can directly obtain a container, the underlying connection will be released, which is the minimum principle.