public abstract class Nio2Service extends AbstractInnerCloseable implements IoService, FactoryManagerHolder
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.nio.channels.AsynchronousChannelGroup |
group |
private IoHandler |
handler |
private FactoryManager |
manager |
protected java.util.Map<java.lang.Long,IoSession> |
sessions |
closeFuture, futureLock, state
log
DEFAULT_REUSE_ADDRESS
Modifier | Constructor and Description |
---|---|
protected |
Nio2Service(FactoryManager manager,
IoHandler handler,
java.nio.channels.AsynchronousChannelGroup group) |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
protected java.nio.channels.AsynchronousChannelGroup |
getChannelGroup() |
FactoryManager |
getFactoryManager() |
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
private final FactoryManager manager
private final IoHandler handler
private final java.nio.channels.AsynchronousChannelGroup group
private IoServiceEventListener eventListener
protected Nio2Service(FactoryManager manager, IoHandler handler, java.nio.channels.AsynchronousChannelGroup group)
public IoServiceEventListener getIoServiceEventListener()
getIoServiceEventListener
in interface IoServiceEventListenerManager
public void setIoServiceEventListener(IoServiceEventListener listener)
setIoServiceEventListener
in interface IoServiceEventListenerManager
protected java.nio.channels.AsynchronousChannelGroup getChannelGroup()
public FactoryManager getFactoryManager()
getFactoryManager
in interface FactoryManagerHolder
FactoryManager
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