ChimdumebiNebolisa commented on code in PR #25156:
URL: https://github.com/apache/pulsar/pull/25156#discussion_r2698446853
##########
pulsar-testclient/src/main/java/org/apache/pulsar/testclient/LoadSimulationController.java:
##########
@@ -77,7 +78,20 @@ public class LoadSimulationController extends CmdBase{
private Random random;
- private static final ExecutorService threadPool =
Executors.newCachedThreadPool();
+ private final ExecutorService threadPool = Executors.newCachedThreadPool();
+
+ @Override
+ public void close() {
+ threadPool.shutdown();
+ try {
+ if (!threadPool.awaitTermination(5, TimeUnit.SECONDS)) {
+ threadPool.shutdownNow();
+ }
+ } catch (InterruptedException e) {
+ threadPool.shutdownNow();
+ Thread.currentThread().interrupt();
+ }
Review Comment:
Good call. Switched to MoreExecutors.shutdownAndAwaitTermination for the
thread pool cleanup.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]