Class PollSelector

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    class PollSelector
    extends java.nio.channels.spi.AbstractSelector
    An implementation of a Selector that uses good old poll(2)
    • Constructor Summary

      Constructors 
      Constructor Description
      PollSelector​(java.nio.channels.spi.SelectorProvider provider)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void add​(PollSelectionKey k)  
      private short getPollEvents​(int idx)  
      private int getPollFD​(int idx)  
      private short getPollRevents​(int idx)  
      protected void implCloseSelector()  
      (package private) void interestOps​(PollSelectionKey k, int ops)  
      java.util.Set<java.nio.channels.SelectionKey> keys()  
      private int poll​(long timeout)  
      private void putPollEvents​(int idx, int events)  
      private void putPollFD​(int idx, int fd)  
      private void putPollRevents​(int idx, int events)  
      protected java.nio.channels.SelectionKey register​(java.nio.channels.spi.AbstractSelectableChannel ch, int ops, java.lang.Object att)  
      private void remove​(PollSelectionKey k)  
      int select()  
      int select​(long timeout)  
      java.util.Set<java.nio.channels.SelectionKey> selectedKeys()  
      int selectNow()  
      java.nio.channels.Selector wakeup()  
      private void wakeupReceived()  
      • Methods inherited from class java.nio.channels.spi.AbstractSelector

        begin, cancelledKeys, close, deregister, end, isOpen, provider
      • Methods inherited from class java.nio.channels.Selector

        open
      • Methods inherited from class java.lang.Object

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

      • PollSelector

        public PollSelector​(java.nio.channels.spi.SelectorProvider provider)
    • Method Detail

      • putPollFD

        private void putPollFD​(int idx,
                               int fd)
      • putPollEvents

        private void putPollEvents​(int idx,
                                   int events)
      • getPollFD

        private int getPollFD​(int idx)
      • getPollEvents

        private short getPollEvents​(int idx)
      • getPollRevents

        private short getPollRevents​(int idx)
      • putPollRevents

        private void putPollRevents​(int idx,
                                    int events)
      • implCloseSelector

        protected void implCloseSelector()
                                  throws java.io.IOException
        Specified by:
        implCloseSelector in class java.nio.channels.spi.AbstractSelector
        Throws:
        java.io.IOException
      • register

        protected java.nio.channels.SelectionKey register​(java.nio.channels.spi.AbstractSelectableChannel ch,
                                                          int ops,
                                                          java.lang.Object att)
        Specified by:
        register in class java.nio.channels.spi.AbstractSelector
      • keys

        public java.util.Set<java.nio.channels.SelectionKey> keys()
        Specified by:
        keys in class java.nio.channels.Selector
      • selectedKeys

        public java.util.Set<java.nio.channels.SelectionKey> selectedKeys()
        Specified by:
        selectedKeys in class java.nio.channels.Selector
      • selectNow

        public int selectNow()
                      throws java.io.IOException
        Specified by:
        selectNow in class java.nio.channels.Selector
        Throws:
        java.io.IOException
      • select

        public int select​(long timeout)
                   throws java.io.IOException
        Specified by:
        select in class java.nio.channels.Selector
        Throws:
        java.io.IOException
      • select

        public int select()
                   throws java.io.IOException
        Specified by:
        select in class java.nio.channels.Selector
        Throws:
        java.io.IOException
      • poll

        private int poll​(long timeout)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • wakeupReceived

        private void wakeupReceived()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • wakeup

        public java.nio.channels.Selector wakeup()
        Specified by:
        wakeup in class java.nio.channels.Selector