diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/StreamBridge.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/StreamBridge.java index 7225f9cad..03f91359c 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/StreamBridge.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/StreamBridge.java @@ -327,14 +327,12 @@ public final class StreamBridge implements StreamOperations, SmartInitializingSi @Override public void destroy() throws Exception { + this.executorService.shutdown(); if (!this.executorService.awaitTermination(10000, TimeUnit.MILLISECONDS)) { logger.warn("Failed to terminate executor. Terminating current tasks."); this.executorService.shutdownNow(); } - else { - this.executorService.shutdown(); - } - + this.executorService = null; this.async = false; channelCache.keySet().forEach(bindingService::unbindProducers);