AbstractNioWorker -> SelectorEventLoop
This commit is contained in:
parent
0d8afa7a4c
commit
a8647d6dc8
@ -39,9 +39,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public abstract class AbstractNioChannel extends AbstractChannel implements NioChannel {
|
||||
|
||||
/**
|
||||
* The {@link AbstractNioWorker}.
|
||||
* The {@link SelectorEventLoop}.
|
||||
*/
|
||||
private final AbstractNioWorker worker;
|
||||
private final SelectorEventLoop worker;
|
||||
|
||||
/**
|
||||
* Monitor object to synchronize access to InterestedOps.
|
||||
@ -97,7 +97,7 @@ public abstract class AbstractNioChannel extends AbstractChannel implements NioC
|
||||
|
||||
private final JdkChannel channel;
|
||||
|
||||
protected AbstractNioChannel(Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, JdkChannel ch) {
|
||||
protected AbstractNioChannel(Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, SelectorEventLoop worker, JdkChannel ch) {
|
||||
super(id, parent, factory, pipeline, sink);
|
||||
this.worker = worker;
|
||||
this.channel = ch;
|
||||
@ -105,7 +105,7 @@ public abstract class AbstractNioChannel extends AbstractChannel implements NioC
|
||||
|
||||
protected AbstractNioChannel(
|
||||
Channel parent, ChannelFactory factory,
|
||||
ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, JdkChannel ch) {
|
||||
ChannelPipeline pipeline, ChannelSink sink, SelectorEventLoop worker, JdkChannel ch) {
|
||||
super(parent, factory, pipeline, sink);
|
||||
this.worker = worker;
|
||||
this.channel = ch;
|
||||
@ -116,11 +116,11 @@ public abstract class AbstractNioChannel extends AbstractChannel implements NioC
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link AbstractNioWorker} that handle the IO of the {@link AbstractNioChannel}
|
||||
* Return the {@link SelectorEventLoop} that handle the IO of the {@link AbstractNioChannel}
|
||||
*
|
||||
* @return worker
|
||||
*/
|
||||
public AbstractNioWorker getWorker() {
|
||||
public SelectorEventLoop getWorker() {
|
||||
return worker;
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* {@link #nextWorker()}
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker> implements WorkerPool<E> , ExternalResourceReleasable {
|
||||
public abstract class AbstractNioWorkerPool<E extends SelectorEventLoop> implements WorkerPool<E> , ExternalResourceReleasable {
|
||||
|
||||
private final AbstractNioWorker[] workers;
|
||||
private final SelectorEventLoop[] workers;
|
||||
private final AtomicInteger workerIndex = new AtomicInteger();
|
||||
private final Executor workerExecutor;
|
||||
|
||||
@ -51,7 +51,7 @@ public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker> impleme
|
||||
"workerCount (" + workerCount + ") " +
|
||||
"must be a positive integer.");
|
||||
}
|
||||
workers = new AbstractNioWorker[workerCount];
|
||||
workers = new SelectorEventLoop[workerCount];
|
||||
|
||||
for (int i = 0; i < workers.length; i++) {
|
||||
workers[i] = createWorker(workerExecutor, allowShutDownOnIdle);
|
||||
|
@ -43,7 +43,7 @@ import java.util.concurrent.Executor;
|
||||
* A class responsible for registering channels with {@link Selector}.
|
||||
* It also implements the {@link Selector} loop.
|
||||
*/
|
||||
public class NioDatagramWorker extends AbstractNioWorker {
|
||||
public class NioDatagramWorker extends SelectorEventLoop {
|
||||
|
||||
/**
|
||||
* Sole constructor.
|
||||
|
@ -34,7 +34,7 @@ import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class NioWorker extends AbstractNioWorker {
|
||||
public class NioWorker extends SelectorEventLoop {
|
||||
|
||||
protected final ReceiveBufferPool recvBufferPool = new ReceiveBufferPool();
|
||||
|
||||
|
@ -47,12 +47,12 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static io.netty.channel.Channels.*;
|
||||
|
||||
abstract class AbstractNioWorker extends SingleThreadEventLoop {
|
||||
abstract class SelectorEventLoop extends SingleThreadEventLoop {
|
||||
/**
|
||||
* Internal Netty logger.
|
||||
*/
|
||||
protected static final InternalLogger logger = InternalLoggerFactory
|
||||
.getInstance(AbstractNioWorker.class);
|
||||
.getInstance(SelectorEventLoop.class);
|
||||
|
||||
private static final int CONSTRAINT_LEVEL = NioProviderMetadata.CONSTRAINT_LEVEL;
|
||||
|
||||
@ -86,11 +86,11 @@ abstract class AbstractNioWorker extends SingleThreadEventLoop {
|
||||
|
||||
protected final SendBufferPool sendBufferPool = new SendBufferPool();
|
||||
|
||||
protected AbstractNioWorker() {
|
||||
protected SelectorEventLoop() {
|
||||
selector = openSelector();
|
||||
}
|
||||
|
||||
protected AbstractNioWorker(ThreadFactory threadFactory) {
|
||||
protected SelectorEventLoop(ThreadFactory threadFactory) {
|
||||
super(threadFactory);
|
||||
selector = openSelector();
|
||||
}
|
Loading…
Reference in New Issue
Block a user