Commit 9d347b7e authored by 赵建伟's avatar 赵建伟

update logs

parent 1e4d4db4
......@@ -16,7 +16,7 @@ public class JdbcConnectPool {
private static final Logger logger = LoggerFactory.getLogger(JdbcConnectPool.class);
private static Properties prop;
private static int currentsize = 0;
private static int requestCount = 0;
private static LinkedList<Connection> connList = new LinkedList<Connection>();
static {
......@@ -29,7 +29,7 @@ public class JdbcConnectPool {
for (int i = 0; i < Integer.valueOf(prop.getProperty("initSize")); i++) {
Connection connection = createConnect();
connList.add(connection);
currentsize++;
//currentsize++;
}
}
......@@ -40,19 +40,21 @@ public class JdbcConnectPool {
*/
public static Connection getConnect() {
Connection connection = null;
if (connList.size() > 0) {
int connSize = connList.size();
if (connSize > 0) {
connection = connList.getFirst();
connList.removeFirst();
currentsize--;
//currentsize--;
} else{
while(currentsize < Integer.valueOf(prop.getProperty("maxSize"))){
while(connSize < Integer.valueOf(prop.getProperty("maxSize"))){
connList.addLast(createConnect());
currentsize++;
//currentsize++;
}
connection = getConnect();
}
logger.info("Current pool size : {}",currentsize);
logger.info("connList size : {}",connList.size());
requestCount ++;
logger.info("requestCount : {}",requestCount);
logger.info("connList size : {}",connSize);
return connection;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment