Skip to content

Commit 54a3d66

Browse files
committed
Refactor invert internal method validateConnection() -> invalidConnection()
1 parent 8e507a1 commit 54a3d66

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,12 @@ private boolean testConnection(Connection conn) throws SQLException {
519519
/**
520520
* Make sure the connection is still ok to use. If not then remove it from the pool.
521521
*/
522-
boolean validateConnection(PooledConnection conn) {
522+
boolean invalidConnection(PooledConnection conn) {
523523
try {
524-
return testConnection(conn);
524+
return !testConnection(conn);
525525
} catch (Exception e) {
526526
Log.warn("Validation test failed on connection:{0} message: {1}", conn.name(), e.getMessage());
527-
return false;
527+
return true;
528528
}
529529
}
530530

ebean-datasource/src/main/java/io/ebean/datasource/pool/PooledConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public void close() throws SQLException {
386386
if (failoverToReadOnly) {
387387
pool.returnConnectionReset(this);
388388
return;
389-
} else if (!pool.validateConnection(this)) {
389+
} else if (pool.invalidConnection(this)) {
390390
// the connection is BAD, remove it, close it and test the pool
391391
pool.returnConnectionForceClose(this);
392392
return;

ebean-datasource/src/main/java/io/ebean/datasource/pool/PooledConnectionQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private boolean staleEviction(PooledConnection c) {
205205
if (Log.isLoggable(DEBUG)) {
206206
Log.debug("stale connection validation millis:{0}", (System.currentTimeMillis() - c.lastUsedTime()));
207207
}
208-
return !pool.validateConnection(c);
208+
return pool.invalidConnection(c);
209209
}
210210

211211
private boolean stale(PooledConnection c) {

0 commit comments

Comments
 (0)