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
This commit is contained in:
Artem Bilan
2017-03-28 20:12:24 -04:00
parent 041290dbb8
commit 8d120e020c

View File

@@ -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();
}
}