Skip to content

Commit abe205e

Browse files
committed
Add executor.shutdownNow()
1 parent 928389b commit abe205e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,11 @@ private void stopHeartBeatIfRunning() {
735735
}
736736
}
737737

738-
static class AsyncCloser implements Runnable {
738+
private static final class AsyncCloser implements Runnable {
739739
final PooledConnection pc;
740740
final boolean logErrors;
741741

742-
public AsyncCloser(PooledConnection pc, boolean logErrors) {
742+
private AsyncCloser(PooledConnection pc, boolean logErrors) {
743743
this.pc = pc;
744744
this.logErrors = logErrors;
745745
}
@@ -794,11 +794,15 @@ private void stopExecutor() {
794794
executor.shutdown();
795795
try {
796796
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
797-
Log.warn("DataSource [{0}] could not terminate executor.", name);
797+
Log.warn("DataSource [{0}] timeout waiting for connections to close", name);
798798
}
799799
} catch (InterruptedException ie) {
800800
Log.warn("DataSource [{0}] could not terminate executor.", name, ie);
801801
}
802+
final var pendingTasks = executor.shutdownNow();
803+
if (!pendingTasks.isEmpty()) {
804+
Log.warn("DataSource [{0}] {1} pending connections were not closed", name, pendingTasks.size());
805+
}
802806
executor = null;
803807
}
804808
} finally {

0 commit comments

Comments
 (0)