summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-03-11 06:28:03 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2021-03-11 06:28:03 +0100
commit7db6536b2715bb1b5fd67360e1dd5f2cb202a416 (patch)
tree6dc00f75fdf9f28a300ac4fd6888fd25c64de7dd /config
parentf9b4a509c0acd9499fe885f5b71c771bef5300e7 (diff)
Ask for fast shutdown of executor.
Only wait 1s for scheduler to complete.
Diffstat (limited to 'config')
-rw-r--r--config/src/main/java/com/yahoo/config/subscription/impl/JRTManagedConnectionPools.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/JRTManagedConnectionPools.java b/config/src/main/java/com/yahoo/config/subscription/impl/JRTManagedConnectionPools.java
index 32d2d962e4d..f0e0a6b8481 100644
--- a/config/src/main/java/com/yahoo/config/subscription/impl/JRTManagedConnectionPools.java
+++ b/config/src/main/java/com/yahoo/config/subscription/impl/JRTManagedConnectionPools.java
@@ -21,12 +21,14 @@ public class JRTManagedConnectionPools {
}
}
private static class CountedPool {
- long count;
final JRTConnectionPool pool;
- final ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1, new JRTSourceThreadFactory());
+ final ScheduledThreadPoolExecutor scheduler;
+ long count;
CountedPool(JRTConnectionPool requester) {
- this.pool = requester;
+ pool = requester;
+ scheduler = new ScheduledThreadPoolExecutor(1, new JRTSourceThreadFactory());
count = 0;
+ scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
}
}
@@ -56,9 +58,9 @@ public class JRTManagedConnectionPools {
}
countedPool.pool.close();
- countedPool.scheduler.shutdown();
+ countedPool.scheduler.shutdownNow();
try {
- countedPool.scheduler.awaitTermination(30, TimeUnit.SECONDS);
+ countedPool.scheduler.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Failed shutting down scheduler:", e);
}