Class Nio2Service
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, Closeable, IoService, IoServiceEventListenerManager
- Direct Known Subclasses:
Nio2Acceptor, Nio2Connector
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractCloseable
AbstractCloseable.State -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<Property<?>, AbstractMap.SimpleImmutableEntry<SocketOption<?>, Object>> protected final AtomicBooleanprivate IoServiceEventListenerprivate final ExecutorServiceprivate final AsynchronousChannelGroupprivate final IoHandlerprivate booleanprotected final PropertyResolverFields inherited from class AbstractCloseable
closeFuture, futureLock, stateFields inherited from class AbstractLoggingBean
logFields inherited from interface IoService
DEFAULT_REUSE_ADDRESS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNio2Service(PropertyResolver propertyResolver, IoHandler handler, AsynchronousChannelGroup group, ExecutorService resumeTasks) -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()protected AsynchronousChannelGroupprotected ExecutorServiceprotected CloseableReturns the map of all sessions which are currently managed by this service.protected IoSessionmapSession(IoSession session) voidsessionClosed(Nio2Session session) voidprotected <T> booleansetOption(NetworkChannel socket, Property<?> property, SocketOption<T> option, T defaultValue) protected <S extends NetworkChannel>
SsetSocketOptions(S socket) private Collection<IoSession> snapshot()protected voidunmapSession(Long sessionId) Methods inherited from class AbstractInnerCloseable
doCloseGracefully, doCloseImmediatelyMethods inherited from class AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerMethods inherited from class AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Field Details
-
CONFIGURABLE_OPTIONS
public static final Map<Property<?>, AbstractMap.SimpleImmutableEntry<SocketOption<?>, Object>> CONFIGURABLE_OPTIONS -
sessions
-
disposing
-
propertyResolver
-
handler
-
group
-
executor
-
eventListener
-
noMoreSessions
private boolean noMoreSessions
-
-
Constructor Details
-
Nio2Service
protected Nio2Service(PropertyResolver propertyResolver, IoHandler handler, AsynchronousChannelGroup group, ExecutorService resumeTasks)
-
-
Method Details
-
getIoServiceEventListener
- Specified by:
getIoServiceEventListenerin interfaceIoServiceEventListenerManager
-
setIoServiceEventListener
- Specified by:
setIoServiceEventListenerin interfaceIoServiceEventListenerManager
-
getChannelGroup
-
getExecutorService
-
getIoHandler
-
dispose
public void dispose() -
getInnerCloseable
- Specified by:
getInnerCloseablein classAbstractInnerCloseable
-
getManagedSessions
Description copied from interface:IoServiceReturns the map of all sessions which are currently managed by this service. The key of map is theIDof the session.- Specified by:
getManagedSessionsin interfaceIoService- Returns:
- the sessions. An empty collection if there's no session.
-
sessionClosed
-
snapshot
-
mapSession
-
unmapSession
-
setSocketOptions
- Throws:
IOException
-
setOption
protected <T> boolean setOption(NetworkChannel socket, Property<?> property, SocketOption<T> option, T defaultValue) throws IOException - Throws:
IOException
-