@@ -378,21 +378,21 @@ private void init(ConnectionPoolDataSource dataSource, int maxConnections, Map<S
378
378
//** getConnection
379
379
//**************************************************************************
380
380
private java .sql .Connection getConnection (long time , long timeoutTime ) {
381
- long rtime = Math .max (1 , timeoutTime - time );
382
- java .sql .Connection conn ;
383
- try {
381
+ long rtime = Math .max (1 , timeoutTime - time );
382
+ java .sql .Connection conn ;
383
+ try {
384
384
conn = acquireConnection (rtime );
385
385
}
386
386
catch (SQLException e ) {
387
387
return null ;
388
388
}
389
389
390
390
// Calculate remaining time for validation
391
- rtime = timeoutTime - System .currentTimeMillis ();
391
+ rtime = timeoutTime - System .currentTimeMillis ();
392
392
int rtimeSecs = Math .max (1 , (int )((rtime + 999 ) / 1000 ));
393
393
394
- try {
395
- if (conn .isValid (rtimeSecs )) {
394
+ try {
395
+ if (conn .isValid (rtimeSecs )) {
396
396
return conn ;
397
397
}
398
398
}
@@ -402,12 +402,12 @@ private java.sql.Connection getConnection(long time, long timeoutTime) {
402
402
// JDBC driver which we ignore and assume that the connection is not valid.
403
403
}
404
404
405
- // When isValid() returns false, the JDBC driver should have already called connectionErrorOccurred()
406
- // and the PooledConnection has been removed from the pool, i.e. the PooledConnection will
407
- // not be added to recycledConnections when Connection.close() is called.
408
- // But to be sure that this works even with a faulty JDBC driver, we call purgeConnection().
409
- purgeConnection (conn );
410
- return null ;
405
+ // When isValid() returns false, the JDBC driver should have already called connectionErrorOccurred()
406
+ // and the PooledConnection has been removed from the pool, i.e. the PooledConnection will
407
+ // not be added to recycledConnections when Connection.close() is called.
408
+ // But to be sure that this works even with a faulty JDBC driver, we call purgeConnection().
409
+ purgeConnection (conn );
410
+ return null ;
411
411
}
412
412
413
413
@@ -702,7 +702,7 @@ private void performHealthCheck() {
702
702
log ("Pool warm-up: added connection " + currentRecycled + "/" + minConnections );
703
703
} else {
704
704
// If validation fails, dispose the connection and decrement counter
705
- disposeConnection (pconn );
705
+ disposeConnection (pconn );
706
706
pconn = null ; // Ensure pconn is null so finally block doesn't try to close it again
707
707
}
708
708
} catch (SQLException e ) {
@@ -887,10 +887,10 @@ private void disposeConnection (PooledConnection pconn) {
887
887
private void log (String msg ) {
888
888
String s = "ConnectionPool: " +msg ;
889
889
try {
890
- if (logWriter == null ) {
890
+ if (logWriter == null ) {
891
891
//System.err.println(s);
892
892
}
893
- else {
893
+ else {
894
894
logWriter .println (s );
895
895
}
896
896
}
@@ -925,13 +925,13 @@ private void assertInnerState() {
925
925
//**************************************************************************
926
926
private class PoolConnectionEventListener implements ConnectionEventListener {
927
927
@ Override
928
- public void connectionClosed (ConnectionEvent event ) {
929
- PooledConnection pconn = (PooledConnection )event .getSource ();
928
+ public void connectionClosed (ConnectionEvent event ) {
929
+ PooledConnection pconn = (PooledConnection )event .getSource ();
930
930
recycleConnection (pconn );
931
931
}
932
932
@ Override
933
- public void connectionErrorOccurred (ConnectionEvent event ) {
934
- PooledConnection pconn = (PooledConnection )event .getSource ();
933
+ public void connectionErrorOccurred (ConnectionEvent event ) {
934
+ PooledConnection pconn = (PooledConnection )event .getSource ();
935
935
disposeConnection (pconn );
936
936
}
937
937
}
@@ -1009,7 +1009,7 @@ public static class PoolStatistics {
1009
1009
public final int totalConnections ;
1010
1010
1011
1011
public PoolStatistics (int activeConnections , int recycledConnections ,
1012
- int availablePermits , int maxConnections , int minConnections , int totalConnections ) {
1012
+ int availablePermits , int maxConnections , int minConnections , int totalConnections ) {
1013
1013
this .activeConnections = activeConnections ;
1014
1014
this .recycledConnections = recycledConnections ;
1015
1015
this .availablePermits = availablePermits ;
0 commit comments