Improved selector loop shutdown time
This commit is contained in:
parent
7d1ec11787
commit
ec8f441ea6
@ -32,6 +32,7 @@ import java.nio.channels.Selector;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@ -228,7 +229,9 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
|
|||||||
// connection attempts are made in a one-by-one manner
|
// connection attempts are made in a one-by-one manner
|
||||||
// instead of concurrent manner.
|
// instead of concurrent manner.
|
||||||
if (selector.keys().isEmpty()) {
|
if (selector.keys().isEmpty()) {
|
||||||
if (shutdown) {
|
if (shutdown ||
|
||||||
|
bossExecutor instanceof ExecutorService && ((ExecutorService) bossExecutor).isShutdown()) {
|
||||||
|
|
||||||
synchronized (selectorGuard) {
|
synchronized (selectorGuard) {
|
||||||
if (selector.keys().isEmpty()) {
|
if (selector.keys().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
@ -32,6 +32,7 @@ import java.nio.channels.Selector;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.jboss.netty.buffer.ChannelBuffer;
|
import org.jboss.netty.buffer.ChannelBuffer;
|
||||||
@ -154,7 +155,8 @@ class NioWorker implements Runnable {
|
|||||||
// connections are registered in a one-by-one manner instead of
|
// connections are registered in a one-by-one manner instead of
|
||||||
// concurrent manner.
|
// concurrent manner.
|
||||||
if (selector.keys().isEmpty()) {
|
if (selector.keys().isEmpty()) {
|
||||||
if (shutdown) {
|
if (shutdown ||
|
||||||
|
executor instanceof ExecutorService && ((ExecutorService) executor).isShutdown()) {
|
||||||
synchronized (selectorGuard) {
|
synchronized (selectorGuard) {
|
||||||
if (selector.keys().isEmpty()) {
|
if (selector.keys().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user