More javadocs
This commit is contained in:
parent
100dd541ba
commit
2710af1b8a
@ -17,6 +17,11 @@ package io.netty.channel;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* Default {@link SingleThreadEventExecutor} implementation which just execute all submitted task in a
|
||||
* serial fashion
|
||||
*
|
||||
*/
|
||||
class DefaultEventExecutor extends SingleThreadEventExecutor {
|
||||
|
||||
DefaultEventExecutor(
|
||||
|
@ -17,8 +17,36 @@ package io.netty.channel;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* The {@link EventExecutor} is a special {@link ScheduledExecutorService} which comes
|
||||
* with some handy methods to see if a {@link Thread} is executed in a event loop.
|
||||
* Beside this it also extends the {@link EventExecutorGroup} to allow a generic way to
|
||||
* access methods.
|
||||
*
|
||||
*/
|
||||
public interface EventExecutor extends EventExecutorGroup, ScheduledExecutorService {
|
||||
|
||||
/**
|
||||
* Returns a reference to itself.
|
||||
*/
|
||||
@Override
|
||||
EventExecutor next();
|
||||
|
||||
/**
|
||||
* Return the {@link EventExecutorGroup} which is the parent of this {@link EventExecutor},
|
||||
* or <code>null</code> if it has no parent
|
||||
|
||||
*/
|
||||
EventExecutorGroup parent();
|
||||
|
||||
/**
|
||||
* Calls {@link #inEventLoop(Thread)} with {@link Thread#currentThread()} as argument
|
||||
*/
|
||||
boolean inEventLoop();
|
||||
|
||||
/**
|
||||
* Return <code>true</code> if the given {@link Thread} is executed in the event loop,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
boolean inEventLoop(Thread thread);
|
||||
}
|
||||
|
@ -18,6 +18,12 @@ package io.netty.channel;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* The {@link EventExecutorGroup} is responsible to provide {@link EventExecutor}'s to use via its
|
||||
* {@link #next()} method. Beside this it also is responsible to handle their live-cycle and allows
|
||||
* to shut them down in a global fashion.
|
||||
*
|
||||
*/
|
||||
public interface EventExecutorGroup {
|
||||
|
||||
/**
|
||||
|
@ -15,10 +15,27 @@
|
||||
*/
|
||||
package io.netty.channel;
|
||||
|
||||
/**
|
||||
* Special {@link EventExecutorGroup} which allows to register {@link Channel}'s that get
|
||||
* processed for later selection during the event loop.
|
||||
*
|
||||
*/
|
||||
public interface EventLoopGroup extends EventExecutorGroup {
|
||||
/**
|
||||
* Return the next {@link EventLoop} to use
|
||||
*/
|
||||
@Override
|
||||
EventLoop next();
|
||||
|
||||
/**
|
||||
* Register a {@link Channel} with this {@link EventLoop}. The returned {@link ChannelFuture}
|
||||
* will get notified once the registration was complete.
|
||||
*/
|
||||
ChannelFuture register(Channel channel);
|
||||
|
||||
/**
|
||||
* Register a {@link Channel} with this {@link EventLoop}. The passed {@link ChannelFuture}
|
||||
* will get notified once the registration was complete and also will get returned.
|
||||
*/
|
||||
ChannelFuture register(Channel channel, ChannelFuture future);
|
||||
}
|
||||
|
@ -34,6 +34,10 @@ import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link EventExecutor}'s that execute all its submitted tasks in a single thread.
|
||||
*
|
||||
*/
|
||||
public abstract class SingleThreadEventExecutor extends AbstractExecutorService implements EventExecutor {
|
||||
|
||||
private static final InternalLogger logger =
|
||||
|
@ -37,6 +37,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* {@link SingleThreadEventLoop} implementation which register the {@link Channel}'s to a
|
||||
* {@link Selector} and so does the multi-plexing of these in the event loop.
|
||||
*
|
||||
*/
|
||||
final class NioEventLoop extends SingleThreadEventLoop {
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,11 @@ import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.SingleThreadEventLoop;
|
||||
|
||||
|
||||
/**
|
||||
* {@link SingleThreadEventLoop} which is used to handle OIO {@link Channel}'s. So in general there will be
|
||||
* one {@link OioEventLoop} per {@link Channel}.
|
||||
*
|
||||
*/
|
||||
class OioEventLoop extends SingleThreadEventLoop {
|
||||
|
||||
private final OioEventLoopGroup parent;
|
||||
|
Loading…
Reference in New Issue
Block a user