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, state
log
DEFAULT_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, doCloseImmediately
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
public 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 IoServiceEventListenerManager
public void setIoServiceEventListener(IoServiceEventListener listener)
setIoServiceEventListener
in interface IoServiceEventListenerManager
protected java.nio.channels.AsynchronousChannelGroup getChannelGroup()
protected java.util.concurrent.ExecutorService getExecutorService()
public IoHandler getIoHandler()
public void dispose()
protected Closeable getInnerCloseable()
getInnerCloseable
in class AbstractInnerCloseable
public java.util.Map<java.lang.Long,IoSession> getManagedSessions()
IoService
ID
of the session.getManagedSessions
in interface IoService
public 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.IOException
protected <T> boolean setOption(java.nio.channels.NetworkChannel socket, Property<?> property, java.net.SocketOption<T> option, T defaultValue) throws java.io.IOException
java.io.IOException