This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 9d085f2 CAMEL-16718: camel-netty - Stop in netty producer changed
order how things are stopped to have a more graceful shutdown in some
situations.
9d085f2 is described below
commit 9d085f24fba68347c3dc97ce9fc4f183855726d0
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Jun 15 13:22:13 2021 +0200
CAMEL-16718: camel-netty - Stop in netty producer changed order how things
are stopped to have a more graceful shutdown in some situations.
---
.../apache/camel/component/netty/NettyProducer.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index bf01b73..764ea9d 100644
---
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -175,26 +175,30 @@ public class NettyProducer extends DefaultAsyncProducer {
@Override
protected void doStop() throws Exception {
LOG.debug("Stopping producer at address: {}",
configuration.getAddress());
+
+ if (pool != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Stopping producer with channel pool[active={},
idle={}]", pool.getNumActive(), pool.getNumIdle());
+ }
+ pool.close();
+ }
+
// close all channels
- LOG.trace("Closing {} channels", allChannels.size());
+ LOG.debug("Closing {} channels", allChannels.size());
ChannelGroupFuture future = allChannels.close();
future.awaitUninterruptibly();
// and then shutdown the thread pools
if (workerGroup != null) {
+ LOG.debug("Stopping worker group: {}", workerGroup);
workerGroup.shutdownGracefully();
workerGroup = null;
}
+ LOG.trace("Stopping correlation manager: {}", correlationManager);
ServiceHelper.stopService(correlationManager);
- if (pool != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Stopping producer with channel pool[active={},
idle={}]", pool.getNumActive(), pool.getNumIdle());
- }
- pool.close();
- }
-
+ LOG.debug("Stopped producer at address: {}",
configuration.getAddress());
super.doStop();
}