From 8d120e020c39a2e6ac4dad6e30cb3877a59f7287 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 28 Mar 2017 20:12:24 -0400 Subject: [PATCH] GH-61: Use shutdown for executors in KinesisMDCA Fixes: spring-projects/spring-integration-aws#61 With the `shutdownNow()` the currently ran task are marked with the `Thread.interrupt()`. The AWS SDK catch this situation and throws `AbortedException` * To let currently ran task finish properly switch from the `shutdownNow()` to the `shutdown()` for internal executors The external Spring-based executors (`ExecutorConfigurationSupport`) must be supplied with the `waitForTasksToCompleteOnShutdown` option --- .../inbound/kinesis/KinesisMessageDrivenChannelAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java index 800c5c2..a55056e 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java +++ b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java @@ -252,10 +252,10 @@ public class KinesisMessageDrivenChannelAdapter extends MessageProducerSupport i @Override public void destroy() throws Exception { if (!this.consumerExecutorExplicitlySet) { - ((ExecutorService) this.consumerExecutor).shutdownNow(); + ((ExecutorService) this.consumerExecutor).shutdown(); } if (!this.dispatcherExecutorExplicitlySet) { - ((ExecutorService) this.dispatcherExecutor).shutdownNow(); + ((ExecutorService) this.dispatcherExecutor).shutdown(); } }