public abstract class Nio2Service extends AbstractInnerCloseable implements IoService
AbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<Property<?>,java.util.AbstractMap.SimpleImmutableEntry<java.net.SocketOption<?>,java.lang.Object>> |
CONFIGURABLE_OPTIONS |
protected java.util.concurrent.atomic.AtomicBoolean |
disposing |
private IoServiceEventListener |
eventListener |
private java.util.concurrent.ExecutorService |
executor |
private java.nio.channels.AsynchronousChannelGroup |
group |
private IoHandler |
handler |
protected PropertyResolver |
propertyResolver |
protected java.util.Map<java.lang.Long,IoSession> |
sessions |
closeFuture, futureLock, statelogDEFAULT_REUSE_ADDRESS| Modifier | Constructor and Description |
|---|---|
protected |
Nio2Service(PropertyResolver propertyResolver,
IoHandler handler,
java.nio.channels.AsynchronousChannelGroup group,
java.util.concurrent.ExecutorService resumeTasks) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
protected java.nio.channels.AsynchronousChannelGroup |
getChannelGroup() |
protected java.util.concurrent.ExecutorService |
getExecutorService() |
protected Closeable |
getInnerCloseable() |
IoHandler |
getIoHandler() |
IoServiceEventListener |
getIoServiceEventListener() |
java.util.Map<java.lang.Long,IoSession> |
getManagedSessions()
Returns the map of all sessions which are currently managed by this service.
|
void |
sessionClosed(Nio2Session session) |
void |
setIoServiceEventListener(IoServiceEventListener listener) |
protected <T> boolean |
setOption(java.nio.channels.NetworkChannel socket,
Property<?> property,
java.net.SocketOption<T> option,
T defaultValue) |
protected <S extends java.nio.channels.NetworkChannel> |
setSocketOptions(S socket) |
protected void |
unmapSession(java.lang.Long sessionId) |
doCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerdebug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerpublic static final java.util.Map<Property<?>,java.util.AbstractMap.SimpleImmutableEntry<java.net.SocketOption<?>,java.lang.Object>> CONFIGURABLE_OPTIONS
protected final java.util.Map<java.lang.Long,IoSession> sessions
protected final java.util.concurrent.atomic.AtomicBoolean disposing
protected final PropertyResolver propertyResolver
private final IoHandler handler
private final java.nio.channels.AsynchronousChannelGroup group
private final java.util.concurrent.ExecutorService executor
private IoServiceEventListener eventListener
protected Nio2Service(PropertyResolver propertyResolver, IoHandler handler, java.nio.channels.AsynchronousChannelGroup group, java.util.concurrent.ExecutorService resumeTasks)
public IoServiceEventListener getIoServiceEventListener()
getIoServiceEventListener in interface IoServiceEventListenerManagerpublic void setIoServiceEventListener(IoServiceEventListener listener)
setIoServiceEventListener in interface IoServiceEventListenerManagerprotected java.nio.channels.AsynchronousChannelGroup getChannelGroup()
protected java.util.concurrent.ExecutorService getExecutorService()
public IoHandler getIoHandler()
public void dispose()
protected Closeable getInnerCloseable()
getInnerCloseable in class AbstractInnerCloseablepublic java.util.Map<java.lang.Long,IoSession> getManagedSessions()
IoServiceID of the session.getManagedSessions in interface IoServicepublic void sessionClosed(Nio2Session session)
protected void unmapSession(java.lang.Long sessionId)
protected <S extends java.nio.channels.NetworkChannel> S setSocketOptions(S socket)
throws java.io.IOException
java.io.IOExceptionprotected <T> boolean setOption(java.nio.channels.NetworkChannel socket,
Property<?> property,
java.net.SocketOption<T> option,
T defaultValue)
throws java.io.IOException
java.io.IOException