Class AprSocketContext.AprPoller

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    AprSocketContext

    class AprSocketContext.AprPoller
    extends java.lang.Thread
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.Long,​AprSocket> channels  
      private long[] desc  
      private int id  
      private java.util.concurrent.atomic.AtomicBoolean inPoll  
      private java.util.concurrent.atomic.AtomicInteger keepAliveCount  
      private long lastPoll  
      private long lastPollTime  
      private java.util.concurrent.atomic.AtomicInteger pollCount  
      private java.util.concurrent.atomic.AtomicInteger polledCount  
      private long pool  
      private long serverPollset  
      private int size  
      private java.util.List<AprSocket> updates  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      AprPoller()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) boolean add​(AprSocket ch)
      Called from any thread, return true if we could add it to pending.
      protected void destroyPoller()
      Destroy the poller.
      (package private) void interruptPoll()  
      boolean isPollerThread()  
      private void pollAdd​(AprSocket up, int req)
      Called only from IO thread
      (package private) int remaining()  
      private void removeSafe​(AprSocket up)
      Called only from IO thread.
      protected void requestUpdate​(AprSocket ch)
      May be called outside of IOThread.
      void run()  
      private void updateIOThread​(AprSocket ch)  
      protected void updates()
      Called only in poller thread, only used if not thread safe
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

        private int id
      • size

        private int size
      • serverPollset

        private long serverPollset
      • pool

        private long pool
      • desc

        private long[] desc
      • lastPoll

        private long lastPoll
      • lastPollTime

        private long lastPollTime
      • inPoll

        private final java.util.concurrent.atomic.AtomicBoolean inPoll
      • channels

        private final java.util.Map<java.lang.Long,​AprSocket> channels
      • keepAliveCount

        private final java.util.concurrent.atomic.AtomicInteger keepAliveCount
      • polledCount

        private final java.util.concurrent.atomic.AtomicInteger polledCount
      • pollCount

        private final java.util.concurrent.atomic.AtomicInteger pollCount
      • updates

        private final java.util.List<AprSocket> updates
    • Constructor Detail

      • AprPoller

        AprPoller()
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • destroyPoller

        protected void destroyPoller()
        Destroy the poller.
      • updates

        protected void updates()
                        throws java.io.IOException
        Called only in poller thread, only used if not thread safe
        Throws:
        java.io.IOException
      • interruptPoll

        void interruptPoll()
      • remaining

        int remaining()
      • add

        boolean add​(AprSocket ch)
             throws java.io.IOException
        Called from any thread, return true if we could add it to pending.
        Throws:
        java.io.IOException
      • requestUpdate

        protected void requestUpdate​(AprSocket ch)
                              throws java.io.IOException
        May be called outside of IOThread.
        Throws:
        java.io.IOException
      • updateIOThread

        private void updateIOThread​(AprSocket ch)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • pollAdd

        private void pollAdd​(AprSocket up,
                             int req)
                      throws java.io.IOException
        Called only from IO thread
        Throws:
        java.io.IOException
      • removeSafe

        private void removeSafe​(AprSocket up)
        Called only from IO thread. Remove from Poll and channels, set POLL bit to false.
      • isPollerThread

        public boolean isPollerThread()