Skip to content

Commit

Permalink
JAMES-3715 Close opened channels
Browse files Browse the repository at this point in the history
See #898 for graceful shutdown
  • Loading branch information
chibenwa committed Mar 22, 2022
1 parent 27ab3a4 commit b2d9f9e
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,20 @@ public synchronized void unbind() {
workerGroup.shutdownGracefully();
}

if (channels != null) {
channels.close();
}

started = false;
}

@Override
public synchronized List<InetSocketAddress> getListenAddresses() {
ImmutableList.Builder<InetSocketAddress> builder = ImmutableList.builder();
for (Channel channel : ImmutableList.copyOf(channels.iterator())) {
builder.add((InetSocketAddress) channel.localAddress());
}
return builder.build();
return channels.stream()
.map(channel -> (InetSocketAddress) channel.localAddress())
.collect(ImmutableList.toImmutableList());
}


/**
* Create ChannelPipelineFactory to use by this Server implementation
*/
Expand Down

0 comments on commit b2d9f9e

Please sign in to comment.