Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -796,23 +796,8 @@ public synchronized void asyncStop(Runnable callback) {
batchFlusherFuture = null;
}

// serverChannelGroup has been unbound in pause()
if (serverChannelGroup != null) {
serverChannelGroup.close().awaitUninterruptibly();
}

if (channelGroup != null) {
ChannelGroupFuture future = channelGroup.close().awaitUninterruptibly();

if (!future.isSuccess()) {
ActiveMQServerLogger.LOGGER.nettyChannelGroupError();
for (Channel channel : future.group()) {
if (channel.isActive()) {
ActiveMQServerLogger.LOGGER.nettyChannelStillOpen(channel, ProxyProtocolUtil.getRemoteAddress(channel));
}
}
}
}
closeChannelGroup(serverChannelGroup);
closeChannelGroup(channelGroup);

channelClazz = null;

Expand All @@ -835,6 +820,17 @@ public synchronized void asyncStop(Runnable callback) {
}
}

private void closeChannelGroup(ChannelGroup channelGroup) {
if (channelGroup != null && !channelGroup.close().awaitUninterruptibly(shutdownTimeout, TimeUnit.MILLISECONDS)) {
ActiveMQServerLogger.LOGGER.nettyChannelGroupError(getName());
for (Channel channel : channelGroup) {
if (channel.isActive()) {
ActiveMQServerLogger.LOGGER.nettyChannelStillOpen(channel, ProxyProtocolUtil.getRemoteAddress(channel), getName());
}
}
}
}

@Override
public void notifyStop() {
if (notificationService != null) {
Expand Down Expand Up @@ -868,10 +864,9 @@ public synchronized void pause() {

// We *pause* the acceptor so no new connections are made
if (serverChannelGroup != null) {
ChannelGroupFuture future = serverChannelGroup.close().awaitUninterruptibly();
if (!future.isSuccess()) {
if (!serverChannelGroup.close().awaitUninterruptibly(shutdownTimeout, TimeUnit.MILLISECONDS)) {
ActiveMQServerLogger.LOGGER.nettyChannelGroupBindError();
for (Channel channel : future.group()) {
for (Channel channel : serverChannelGroup) {
if (channel.isActive()) {
ActiveMQServerLogger.LOGGER.nettyChannelStillBound(channel, ProxyProtocolUtil.getRemoteAddress(channel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,11 @@ void slowConsumerDetected(String sessionID,
@LogMessage(id = 222072, value = "Timed out flushing channel on InVMConnection", level = LogMessage.Level.WARN)
void timedOutFlushingInvmChannel();

@LogMessage(id = 222074, value = "channel group did not completely close", level = LogMessage.Level.WARN)
void nettyChannelGroupError();
@LogMessage(id = 222074, value = "Netty ChannelGroup did not completely close for acceptor '{}'", level = LogMessage.Level.WARN)
void nettyChannelGroupError(String acceptor);

@LogMessage(id = 222075, value = "{} is still connected to {}", level = LogMessage.Level.WARN)
void nettyChannelStillOpen(Channel channel, String remoteAddress);
@LogMessage(id = 222075, value = "{} is still connected to {} for acceptor '{}'", level = LogMessage.Level.WARN)
void nettyChannelStillOpen(Channel channel, String remoteAddress, String acceptor);

@LogMessage(id = 222076, value = "channel group did not completely unbind", level = LogMessage.Level.WARN)
void nettyChannelGroupBindError();
Expand Down
6 changes: 6 additions & 0 deletions docs/user-manual/configuring-transports.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ autoStart::
Determines whether or not an acceptor will start automatically when the broker is started.
Default value is `true`.

shutdownTimeout::
This is only valid for acceptors.
It is the number of milliseconds the broker will wait when shutting down each of the various Netty `ChannelGroup` instances as well as the `EventLoopGroup` instance associated with the acceptor.
The default is `3000`.
The default can also be set with the Java system property `DEFAULT_SHUTDOWN_TIMEOUT`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt look to be accurate, the system property that is being inspected has a class name prefix, so it looks to actually be:
org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_SHUTDOWN_TIMEOUT


=== Configuring Netty Native Transport

Netty Native Transport support exists for selected OS platforms in order to use native sockets/io instead of Java NIO.
Expand Down