Explicit synchronize on eventLoopGroups object

This commit is contained in:
nathan 2018-01-22 15:23:09 +01:00
parent 21186fb0c4
commit d6e7affa1e

View File

@ -278,7 +278,13 @@ class EndPoint {
// we want to WAIT until after the event executors have completed shutting down.
List<Future<?>> shutdownThreadList = new LinkedList<Future<?>>();
for (EventLoopGroup loopGroup : eventLoopGroups) {
List<EventLoopGroup> loopGroups;
synchronized (eventLoopGroups) {
loopGroups = new ArrayList<EventLoopGroup>(eventLoopGroups.size());
loopGroups.addAll(eventLoopGroups);
}
for (EventLoopGroup loopGroup : loopGroups) {
shutdownThreadList.add(loopGroup.shutdownGracefully(maxShutdownWaitTimeInMilliSeconds,
maxShutdownWaitTimeInMilliSeconds * 4,
TimeUnit.MILLISECONDS));