Remove @deprecated use of allowShutDownOnIdle in the AbstractNioWorker and AbstractNioWorkerPool implementation. See #583

This commit is contained in:
Norman Maurer 2012-09-03 21:21:24 +02:00
parent 64b9e8fb40
commit 3bdccc633a
6 changed files with 7 additions and 90 deletions

View File

@ -121,20 +121,8 @@ abstract class AbstractNioWorker implements Worker {
protected final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool();
private final boolean allowShutdownOnIdle;
AbstractNioWorker(Executor executor) {
this(executor, true);
}
/**
*
* @deprecated Use {@link #AbstractNioWorker(Executor)}
*/
@Deprecated
public AbstractNioWorker(Executor executor, boolean allowShutdownOnIdle) {
this.executor = executor;
this.allowShutdownOnIdle = allowShutdownOnIdle;
openSelector();
}
@ -370,11 +358,6 @@ abstract class AbstractNioWorker implements Worker {
shutdown = false;
}
}
} else {
if (allowShutdownOnIdle) {
// Give one more second.
shutdown = true;
}
}
} else {
shutdown = false;

View File

@ -19,7 +19,6 @@ package org.jboss.netty.channel.socket.nio;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.socket.Worker;
import org.jboss.netty.util.ExternalResourceReleasable;
import org.jboss.netty.util.internal.ExecutorUtil;
@ -34,18 +33,15 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
private final AbstractNioWorker[] workers;
private final AtomicInteger workerIndex = new AtomicInteger();
private final Executor workerExecutor;
private final boolean allowShutDownOnIdle;
/**
* Create a new instance
*
* @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
* @deprecated use {@link #AbstractNioWorkerPool(Executor, int)}
*/
AbstractNioWorkerPool(Executor workerExecutor, int workerCount, boolean allowShutDownOnIdle) {
AbstractNioWorkerPool(Executor workerExecutor, int workerCount) {
if (workerExecutor == null) {
throw new NullPointerException("workerExecutor");
}
@ -59,34 +55,9 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
for (int i = 0; i < workers.length; i++) {
workers[i] = createWorker(workerExecutor);
}
this.allowShutDownOnIdle = allowShutDownOnIdle;
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
*
@ -94,9 +65,7 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
* @param executor the {@link Executor} to use
* @return worker the new {@link Worker}
*/
protected E createWorker(Executor executor) {
return createWorker(executor, allowShutDownOnIdle);
}
protected abstract E createWorker(Executor executor);
@SuppressWarnings("unchecked")
public E nextWorker() {

View File

@ -54,15 +54,6 @@ public class NioDatagramWorker extends AbstractNioWorker {
super(executor);
}
/**
*
* @deprecated use {@link #NioDatagramWorker(Executor)}
*/
@Deprecated
NioDatagramWorker(final Executor executor, boolean allowShutdownOnIdle) {
super(executor, allowShutdownOnIdle);
}
@Override
protected boolean read(final SelectionKey key) {
final NioDatagramChannel channel = (NioDatagramChannel) key.attachment();

View File

@ -25,21 +25,13 @@ import java.util.concurrent.Executor;
*/
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) {
super(executor, workerCount);
}
@Override
protected NioDatagramWorker createWorker(Executor executor, boolean allowShutdownOnIdle) {
return new NioDatagramWorker(executor, allowShutdownOnIdle);
protected NioDatagramWorker createWorker(Executor executor) {
return new NioDatagramWorker(executor);
}
}

View File

@ -40,16 +40,6 @@ public class NioWorker extends AbstractNioWorker {
super(executor);
}
/**
*
* @deprecated use {@link #NioWorker(Executor)}
*/
@Deprecated
public NioWorker(Executor executor, boolean allowShutdownOnIdle) {
super(executor, allowShutdownOnIdle);
}
@Override
protected boolean read(SelectionKey k) {
final SocketChannel ch = (SocketChannel) k.channel();

View File

@ -25,21 +25,13 @@ import java.util.concurrent.Executor;
*/
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) {
super(workerExecutor, workerCount);
}
@Override
protected NioWorker createWorker(Executor executor, boolean allowShutdownOnIdle) {
return new NioWorker(executor, allowShutdownOnIdle);
protected NioWorker createWorker(Executor executor) {
return new NioWorker(executor);
}
}