[#662] Fix race in AioEventLoopGroup

- Fix a bug where shutdown() blocks indefinitely sometimes
This commit is contained in:
Trustin Lee 2012-10-23 16:09:59 -07:00
parent c38c1d0e6f
commit c43b9b4dd2

View File

@ -78,7 +78,11 @@ public class AioEventLoopGroup extends MultithreadEventLoopGroup {
boolean interrupted = false;
// Tell JDK not to accept any more registration request. Note that the threads are not really shut down yet.
group.shutdown();
try {
group.shutdownNow();
} catch (IOException e) {
throw new EventLoopException("failed to shut down a channel group", e);
}
// Wait until JDK propagates the shutdown request on AsynchronousChannelGroup to the ExecutorService.
// JDK will probably submit some final tasks to the ExecutorService before shutting down the ExecutorService,