Skip to content

Commit 73ee3a0

Browse files
committed
Fixed come minor code formatting issues in ConnectionPool
1 parent d4cd8e3 commit 73ee3a0

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/javaxt/sql/ConnectionPool.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,21 @@ private void init(ConnectionPoolDataSource dataSource, int maxConnections, Map<S
378378
//** getConnection
379379
//**************************************************************************
380380
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 {
384384
conn = acquireConnection(rtime);
385385
}
386386
catch (SQLException e) {
387387
return null;
388388
}
389389

390390
// Calculate remaining time for validation
391-
rtime = timeoutTime - System.currentTimeMillis();
391+
rtime = timeoutTime - System.currentTimeMillis();
392392
int rtimeSecs = Math.max(1, (int)((rtime + 999) / 1000));
393393

394-
try {
395-
if (conn.isValid(rtimeSecs)) {
394+
try {
395+
if (conn.isValid(rtimeSecs)) {
396396
return conn;
397397
}
398398
}
@@ -402,12 +402,12 @@ private java.sql.Connection getConnection(long time, long timeoutTime) {
402402
// JDBC driver which we ignore and assume that the connection is not valid.
403403
}
404404

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;
411411
}
412412

413413

@@ -702,7 +702,7 @@ private void performHealthCheck() {
702702
log("Pool warm-up: added connection " + currentRecycled + "/" + minConnections);
703703
} else {
704704
// If validation fails, dispose the connection and decrement counter
705-
disposeConnection(pconn);
705+
disposeConnection(pconn);
706706
pconn = null; // Ensure pconn is null so finally block doesn't try to close it again
707707
}
708708
} catch (SQLException e) {
@@ -887,10 +887,10 @@ private void disposeConnection (PooledConnection pconn) {
887887
private void log(String msg) {
888888
String s = "ConnectionPool: "+msg;
889889
try {
890-
if (logWriter == null) {
890+
if (logWriter == null) {
891891
//System.err.println(s);
892892
}
893-
else {
893+
else {
894894
logWriter.println(s);
895895
}
896896
}
@@ -925,13 +925,13 @@ private void assertInnerState() {
925925
//**************************************************************************
926926
private class PoolConnectionEventListener implements ConnectionEventListener {
927927
@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();
930930
recycleConnection(pconn);
931931
}
932932
@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();
935935
disposeConnection(pconn);
936936
}
937937
}
@@ -1009,7 +1009,7 @@ public static class PoolStatistics {
10091009
public final int totalConnections;
10101010

10111011
public PoolStatistics(int activeConnections, int recycledConnections,
1012-
int availablePermits, int maxConnections, int minConnections, int totalConnections) {
1012+
int availablePermits, int maxConnections, int minConnections, int totalConnections) {
10131013
this.activeConnections = activeConnections;
10141014
this.recycledConnections = recycledConnections;
10151015
this.availablePermits = availablePermits;

0 commit comments

Comments
 (0)