Remove @deprecated use of allowShutDownOnIdle in the AbstractNioWorker and AbstractNioWorkerPool implementation. See #583
This commit is contained in:
parent
64b9e8fb40
commit
3bdccc633a
@ -121,20 +121,8 @@ abstract class AbstractNioWorker implements Worker {
|
|||||||
|
|
||||||
protected final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool();
|
protected final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool();
|
||||||
|
|
||||||
private final boolean allowShutdownOnIdle;
|
|
||||||
|
|
||||||
AbstractNioWorker(Executor executor) {
|
AbstractNioWorker(Executor executor) {
|
||||||
this(executor, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #AbstractNioWorker(Executor)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public AbstractNioWorker(Executor executor, boolean allowShutdownOnIdle) {
|
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
this.allowShutdownOnIdle = allowShutdownOnIdle;
|
|
||||||
openSelector();
|
openSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,11 +358,6 @@ abstract class AbstractNioWorker implements Worker {
|
|||||||
shutdown = false;
|
shutdown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (allowShutdownOnIdle) {
|
|
||||||
// Give one more second.
|
|
||||||
shutdown = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shutdown = false;
|
shutdown = false;
|
||||||
|
@ -19,7 +19,6 @@ package org.jboss.netty.channel.socket.nio;
|
|||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.jboss.netty.channel.Channel;
|
|
||||||
import org.jboss.netty.channel.socket.Worker;
|
import org.jboss.netty.channel.socket.Worker;
|
||||||
import org.jboss.netty.util.ExternalResourceReleasable;
|
import org.jboss.netty.util.ExternalResourceReleasable;
|
||||||
import org.jboss.netty.util.internal.ExecutorUtil;
|
import org.jboss.netty.util.internal.ExecutorUtil;
|
||||||
@ -34,18 +33,15 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
|
|||||||
private final AbstractNioWorker[] workers;
|
private final AbstractNioWorker[] workers;
|
||||||
private final AtomicInteger workerIndex = new AtomicInteger();
|
private final AtomicInteger workerIndex = new AtomicInteger();
|
||||||
private final Executor workerExecutor;
|
private final Executor workerExecutor;
|
||||||
private final boolean allowShutDownOnIdle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance
|
* Create a new instance
|
||||||
*
|
*
|
||||||
* @param workerExecutor the {@link Executor} to use for the {@link Worker}'s
|
* @param workerExecutor the {@link Executor} to use for the {@link Worker}'s
|
||||||
* @param allowShutdownOnIdle allow the {@link Worker}'s to shutdown when there is not
|
|
||||||
* {@link Channel} is registered with it
|
|
||||||
* @param workerCount the count of {@link Worker}'s to create
|
* @param workerCount the count of {@link Worker}'s to create
|
||||||
* @deprecated use {@link #AbstractNioWorkerPool(Executor, int)}
|
|
||||||
*/
|
*/
|
||||||
AbstractNioWorkerPool(Executor workerExecutor, int workerCount, boolean allowShutDownOnIdle) {
|
AbstractNioWorkerPool(Executor workerExecutor, int workerCount) {
|
||||||
if (workerExecutor == null) {
|
if (workerExecutor == null) {
|
||||||
throw new NullPointerException("workerExecutor");
|
throw new NullPointerException("workerExecutor");
|
||||||
}
|
}
|
||||||
@ -59,34 +55,9 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
|
|||||||
for (int i = 0; i < workers.length; i++) {
|
for (int i = 0; i < workers.length; i++) {
|
||||||
workers[i] = createWorker(workerExecutor);
|
workers[i] = createWorker(workerExecutor);
|
||||||
}
|
}
|
||||||
this.allowShutDownOnIdle = allowShutDownOnIdle;
|
|
||||||
this.workerExecutor = workerExecutor;
|
this.workerExecutor = workerExecutor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new instance
|
|
||||||
*
|
|
||||||
* @param workerExecutor the {@link Executor} to use for the {@link Worker}'s
|
|
||||||
* @param workerCount the count of {@link Worker}'s to create
|
|
||||||
*/
|
|
||||||
AbstractNioWorkerPool(Executor workerExecutor, int workerCount) {
|
|
||||||
this(workerExecutor, workerCount, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new {@link Worker} which uses the given {@link Executor} to service IO
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param executor the {@link Executor} to use
|
|
||||||
* @param allowShutdownOnIdle allow the {@link Worker} to shutdown when there is not
|
|
||||||
* {@link Channel} is registered with it
|
|
||||||
* @return worker the new {@link Worker}
|
|
||||||
* @deprecated use {@link #createWorker(Executor)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected abstract E createWorker(Executor executor, boolean allowShutdownOnIdle);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link Worker} which uses the given {@link Executor} to service IO
|
* Create a new {@link Worker} which uses the given {@link Executor} to service IO
|
||||||
*
|
*
|
||||||
@ -94,9 +65,7 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
|
|||||||
* @param executor the {@link Executor} to use
|
* @param executor the {@link Executor} to use
|
||||||
* @return worker the new {@link Worker}
|
* @return worker the new {@link Worker}
|
||||||
*/
|
*/
|
||||||
protected E createWorker(Executor executor) {
|
protected abstract E createWorker(Executor executor);
|
||||||
return createWorker(executor, allowShutDownOnIdle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public E nextWorker() {
|
public E nextWorker() {
|
||||||
|
@ -54,15 +54,6 @@ public class NioDatagramWorker extends AbstractNioWorker {
|
|||||||
super(executor);
|
super(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #NioDatagramWorker(Executor)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
NioDatagramWorker(final Executor executor, boolean allowShutdownOnIdle) {
|
|
||||||
super(executor, allowShutdownOnIdle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean read(final SelectionKey key) {
|
protected boolean read(final SelectionKey key) {
|
||||||
final NioDatagramChannel channel = (NioDatagramChannel) key.attachment();
|
final NioDatagramChannel channel = (NioDatagramChannel) key.attachment();
|
||||||
|
@ -25,21 +25,13 @@ import java.util.concurrent.Executor;
|
|||||||
*/
|
*/
|
||||||
public class NioDatagramWorkerPool extends AbstractNioWorkerPool<NioDatagramWorker> {
|
public class NioDatagramWorkerPool extends AbstractNioWorkerPool<NioDatagramWorker> {
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #NioDatagramWorkerPool(Executor, int)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public NioDatagramWorkerPool(Executor executor, int workerCount, boolean allowShutdownOnIdle) {
|
|
||||||
super(executor, workerCount, allowShutdownOnIdle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NioDatagramWorkerPool(Executor executor, int workerCount) {
|
public NioDatagramWorkerPool(Executor executor, int workerCount) {
|
||||||
super(executor, workerCount);
|
super(executor, workerCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NioDatagramWorker createWorker(Executor executor, boolean allowShutdownOnIdle) {
|
protected NioDatagramWorker createWorker(Executor executor) {
|
||||||
return new NioDatagramWorker(executor, allowShutdownOnIdle);
|
return new NioDatagramWorker(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,16 +40,6 @@ public class NioWorker extends AbstractNioWorker {
|
|||||||
super(executor);
|
super(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #NioWorker(Executor)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public NioWorker(Executor executor, boolean allowShutdownOnIdle) {
|
|
||||||
super(executor, allowShutdownOnIdle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean read(SelectionKey k) {
|
protected boolean read(SelectionKey k) {
|
||||||
final SocketChannel ch = (SocketChannel) k.channel();
|
final SocketChannel ch = (SocketChannel) k.channel();
|
||||||
|
@ -25,21 +25,13 @@ import java.util.concurrent.Executor;
|
|||||||
*/
|
*/
|
||||||
public class NioWorkerPool extends AbstractNioWorkerPool<NioWorker> {
|
public class NioWorkerPool extends AbstractNioWorkerPool<NioWorker> {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #NioWorkerPool(Executor, int)}
|
|
||||||
*/
|
|
||||||
public NioWorkerPool(Executor executor, int workerCount, boolean allowShutdownOnIdle) {
|
|
||||||
super(executor, workerCount, allowShutdownOnIdle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NioWorkerPool(Executor workerExecutor, int workerCount) {
|
public NioWorkerPool(Executor workerExecutor, int workerCount) {
|
||||||
super(workerExecutor, workerCount);
|
super(workerExecutor, workerCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NioWorker createWorker(Executor executor, boolean allowShutdownOnIdle) {
|
protected NioWorker createWorker(Executor executor) {
|
||||||
return new NioWorker(executor, allowShutdownOnIdle);
|
return new NioWorker(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user