Class AbstractPollingIoProcessor.Processor

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    AbstractPollingIoProcessor<S extends AbstractIoSession>

    private class AbstractPollingIoProcessor.Processor
    extends java.lang.Object
    implements java.lang.Runnable
    The main loop. This is the place in charge to poll the Selector, and to process the active sessions. It's done in - handle the newly created sessions -
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Processor()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean addNow​(S session)
      Process a new session : - initialize it - create its chain - fire the CREATED listeners if any
      private void clearWriteRequestQueue​(S session)  
      private void fireMessageSent​(S session, WriteRequest req)  
      private void flush​(long currentTime)
      Write all the pending messages
      private boolean flushNow​(S session, long currentTime)  
      private int handleNewSessions()
      Loops over the new sessions blocking queue and returns the number of sessions which are effectively created
      private void notifyIdleSessions​(long currentTime)  
      private void process()  
      private void process​(S session)
      Deal with session ready for the read or write operations, or both.
      private boolean removeNow​(S session)  
      private int removeSessions()  
      void run()
      private void scheduleFlush​(S session)  
      private void updateTrafficMask()
      Update the trafficControl for all the session.
      private int writeBuffer​(S session, WriteRequest req, boolean hasFragmentation, int maxLength, long currentTime)  
      private int writeFile​(S session, WriteRequest req, boolean hasFragmentation, int maxLength, long currentTime)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Processor

        private Processor()
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • handleNewSessions

        private int handleNewSessions()
        Loops over the new sessions blocking queue and returns the number of sessions which are effectively created
        Returns:
        The number of new sessions
      • notifyIdleSessions

        private void notifyIdleSessions​(long currentTime)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • updateTrafficMask

        private void updateTrafficMask()
        Update the trafficControl for all the session.
      • addNow

        private boolean addNow​(S session)
        Process a new session : - initialize it - create its chain - fire the CREATED listeners if any
        Parameters:
        session - The session to create
        Returns:
        true if the session has been registered
      • removeSessions

        private int removeSessions()
      • flush

        private void flush​(long currentTime)
        Write all the pending messages
      • flushNow

        private boolean flushNow​(S session,
                                 long currentTime)
      • scheduleFlush

        private void scheduleFlush​(S session)
      • writeFile

        private int writeFile​(S session,
                              WriteRequest req,
                              boolean hasFragmentation,
                              int maxLength,
                              long currentTime)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • writeBuffer

        private int writeBuffer​(S session,
                                WriteRequest req,
                                boolean hasFragmentation,
                                int maxLength,
                                long currentTime)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • removeNow

        private boolean removeNow​(S session)
      • clearWriteRequestQueue

        private void clearWriteRequestQueue​(S session)
      • fireMessageSent

        private void fireMessageSent​(S session,
                                     WriteRequest req)
      • process

        private void process()
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • process

        private void process​(S session)
        Deal with session ready for the read or write operations, or both.