Class Nio2Service

    • Field Detail

      • CONFIGURABLE_OPTIONS

        public static final java.util.Map<Property<?>,​java.util.AbstractMap.SimpleImmutableEntry<java.net.SocketOption<?>,​java.lang.Object>> CONFIGURABLE_OPTIONS
      • sessions

        protected final java.util.Map<java.lang.Long,​IoSession> sessions
      • disposing

        protected final java.util.concurrent.atomic.AtomicBoolean disposing
      • group

        private final java.nio.channels.AsynchronousChannelGroup group
      • executor

        private final java.util.concurrent.ExecutorService executor
    • Constructor Detail

      • Nio2Service

        protected Nio2Service​(PropertyResolver propertyResolver,
                              IoHandler handler,
                              java.nio.channels.AsynchronousChannelGroup group,
                              java.util.concurrent.ExecutorService resumeTasks)
    • Method Detail

      • getChannelGroup

        protected java.nio.channels.AsynchronousChannelGroup getChannelGroup()
      • getExecutorService

        protected java.util.concurrent.ExecutorService getExecutorService()
      • getIoHandler

        public IoHandler getIoHandler()
      • dispose

        public void dispose()
      • getManagedSessions

        public java.util.Map<java.lang.Long,​IoSession> getManagedSessions()
        Description copied from interface: IoService
        Returns the map of all sessions which are currently managed by this service. The key of map is the ID of the session.
        Specified by:
        getManagedSessions in interface IoService
        Returns:
        the sessions. An empty collection if there's no session.
      • sessionClosed

        public void sessionClosed​(Nio2Session session)
      • unmapSession

        protected void unmapSession​(java.lang.Long sessionId)
      • setSocketOptions

        protected <S extends java.nio.channels.NetworkChannel> S setSocketOptions​(S socket)
                                                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • setOption

        protected <T> boolean setOption​(java.nio.channels.NetworkChannel socket,
                                        Property<?> property,
                                        java.net.SocketOption<T> option,
                                        T defaultValue)
                                 throws java.io.IOException
        Throws:
        java.io.IOException