Class AbstractController

    • Field Detail

      • statisticsInterval

        protected long statisticsInterval
      • log

        protected static final org.slf4j.Logger log
      • stateListeners

        protected java.util.concurrent.CopyOnWriteArrayList<ControllerStateListener> stateListeners
        controller state listener list
      • handler

        protected Handler handler
        Event handler
      • codecFactory

        protected CodecFactory codecFactory
        Codec Factory
      • started

        protected volatile boolean started
        Status
      • localSocketAddress

        protected java.net.InetSocketAddress localSocketAddress
        local bind address
      • readThreadCount

        protected int readThreadCount
        Read event processing thread count
      • writeThreadCount

        protected int writeThreadCount
      • dispatchMessageThreadCount

        protected int dispatchMessageThreadCount
      • readEventDispatcher

        protected Dispatcher readEventDispatcher
      • dispatchMessageDispatcher

        protected Dispatcher dispatchMessageDispatcher
      • writeEventDispatcher

        protected Dispatcher writeEventDispatcher
      • sessionTimeout

        protected long sessionTimeout
      • handleReadWriteConcurrently

        protected boolean handleReadWriteConcurrently
      • soTimeout

        protected int soTimeout
      • socketOptions

        protected java.util.Map<SocketOption,​java.lang.Object> socketOptions
        Socket options
      • sessionSet

        protected java.util.Set<Session> sessionSet
        Connected session set
      • shutdownHookThread

        private java.lang.Thread shutdownHookThread
      • isHutdownHookCalled

        private volatile boolean isHutdownHookCalled
    • Constructor Detail

      • AbstractController

        public AbstractController()
      • AbstractController

        public AbstractController​(Configuration configuration)
    • Method Detail

      • setSocketOptions

        public void setSocketOptions​(java.util.Map<SocketOption,​java.lang.Object> socketOptions)
      • buildQueue

        protected java.util.Queue<WriteMessage> buildQueue()
        Build write queue for session
        Returns:
      • setSoTimeout

        public void setSoTimeout​(int timeout)
        Specified by:
        setSoTimeout in interface Controller
      • setStarted

        void setStarted​(boolean started)
      • setStatisticsConfig

        private void setStatisticsConfig​(Configuration configuration)
      • setConfiguration

        public void setConfiguration​(Configuration configuration)
      • setLocalSocketAddress

        public void setLocalSocketAddress​(java.net.InetSocketAddress inetSocketAddress)
        Specified by:
        setLocalSocketAddress in interface Controller
      • onAccept

        public void onAccept​(java.nio.channels.SelectionKey sk)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • onConnect

        public void onConnect​(java.nio.channels.SelectionKey key)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • setWriteThreadCount

        public final void setWriteThreadCount​(int writeThreadCount)
        Specified by:
        setWriteThreadCount in interface Controller
      • start

        public void start()
                   throws java.io.IOException
        Specified by:
        start in interface Controller
        Throws:
        java.io.IOException
      • start0

        protected abstract void start0()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • setDispatchMessageDispatcher

        void setDispatchMessageDispatcher​(Dispatcher dispatcher)
      • getReadEventDispatcher

        Dispatcher getReadEventDispatcher()
      • setReadEventDispatcher

        void setReadEventDispatcher​(Dispatcher dispatcher)
      • setWriteEventDispatcher

        void setWriteEventDispatcher​(Dispatcher dispatcher)
      • startStatistics

        private final void startStatistics()
      • unregisterSession

        public final void unregisterSession​(Session session)
      • checkStatisticsForRestart

        public void checkStatisticsForRestart()
      • registerSession

        public final void registerSession​(Session session)
      • stop

        public void stop()
                  throws java.io.IOException
        Specified by:
        stop in interface Controller
        Throws:
        java.io.IOException
      • stop0

        protected abstract void stop0()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • stopDispatcher

        private final void stopDispatcher()
      • stopStatistics

        private final void stopStatistics()
      • clearStateListeners

        private final void clearStateListeners()
      • getSessionSet

        public java.util.Set<Session> getSessionSet()
      • getSocketOption

        public <T> T getSocketOption​(SocketOption<T> socketOption)
      • bind

        public void bind​(java.net.InetSocketAddress inetSocketAddress)
                  throws java.io.IOException
        Bind localhost address
        Parameters:
        inetSocketAddress -
        Throws:
        java.io.IOException