File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/main/java/com/rabbitmq/stream/perf Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -560,6 +560,8 @@ public Integer call() throws Exception {
560560 this .messageSize = this .messageSize < 8 ? 8 : this .messageSize ; // we need to store a long in it
561561
562562 ShutdownService shutdownService = new ShutdownService ();
563+ Thread shutdownServiceShutdownHook = new Thread (() -> shutdownService .close ());
564+ Runtime .getRuntime ().addShutdownHook (shutdownServiceShutdownHook );
563565
564566 try {
565567
@@ -570,8 +572,6 @@ public Integer call() throws Exception {
570572
571573 shutdownService .wrap (closeStep ("Closing monitoring context" , monitoringContext ::close ));
572574
573- Runtime .getRuntime ().addShutdownHook (new Thread (() -> shutdownService .close ()));
574-
575575 // FIXME add confirm latency
576576
577577 ScheduledExecutorService envExecutor =
@@ -958,6 +958,7 @@ public Integer call() throws Exception {
958958 }
959959 } finally {
960960 shutdownService .close ();
961+ Runtime .getRuntime ().removeShutdownHook (shutdownServiceShutdownHook );
961962 }
962963
963964 return 0 ;
You can’t perform that action at this time.
0 commit comments