Skip to content

Commit b92d620

Browse files
karenc-bqsergiyvamz
authored andcommitted
chore: address comments
1 parent 3b6b3e2 commit b92d620

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wrapper/src/main/java/software/amazon/jdbc/plugin/efm2/HostMonitorImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class HostMonitorImpl extends AbstractMonitor implements HostMonitor {
5252
private static final long THREAD_SLEEP_NANO = TimeUnit.MILLISECONDS.toNanos(100);
5353
private static final long TERMINATION_TIMEOUT_SEC = 30;
5454
private static final String MONITORING_PROPERTY_PREFIX = "monitoring-";
55+
private static final int MIN_VALIDITY_CHECK_TIMEOUT_SEC = 1;
5556

5657
protected static final Executor ABORT_EXECUTOR =
5758
ExecutorFactory.newSingleThreadExecutor("abort");
@@ -324,7 +325,7 @@ boolean checkConnectionStatus() {
324325
final int validTimeout = (int) TimeUnit.NANOSECONDS.toSeconds(
325326
this.failureDetectionIntervalNano - THREAD_SLEEP_NANO) / 2;
326327
// validTimeout could get rounded down to 0.
327-
return this.monitoringConn.isValid(Math.max(1, validTimeout));
328+
return this.monitoringConn.isValid(Math.max(MIN_VALIDITY_CHECK_TIMEOUT_SEC, validTimeout));
328329
} catch (final SQLException sqlEx) {
329330
return false;
330331
} finally {

0 commit comments

Comments
 (0)