Class VirtualChannelSelectorImpl


  • public class VirtualChannelSelectorImpl
    extends java.lang.Object
    Provides a simplified and safe (selectable-channel) socket single-op selector.
    • Field Detail

      • LOGID

        private static final LogIDs LOGID
      • MAYBE_BROKEN_SELECT

        private static final boolean MAYBE_BROKEN_SELECT
      • get_selector_allowed

        static final AESemaphore get_selector_allowed
      • select_is_broken

        private boolean select_is_broken
      • select_looks_broken_count

        private int select_looks_broken_count
      • logged_broken_select

        private boolean logged_broken_select
      • selector

        protected java.nio.channels.Selector selector
      • consec_select_fails

        private int consec_select_fails
      • consec_select_fails_start

        private long consec_select_fails_start
      • register_cancel_list

        private final java.util.Map<java.nio.channels.spi.AbstractSelectableChannel,​java.lang.Object> register_cancel_list
      • register_cancel_list_mon

        private final AEMonitor register_cancel_list_mon
      • paused_states

        private final java.util.HashMap<java.nio.channels.spi.AbstractSelectableChannel,​java.lang.Boolean> paused_states
      • INTEREST_OP

        private final int INTEREST_OP
      • pause_after_select

        private final boolean pause_after_select
      • destroyed

        private volatile boolean destroyed
      • randomise_keys

        private boolean randomise_keys
      • next_select_loop_pos

        private int next_select_loop_pos
      • WRITE_SELECTOR_DEBUG_CHECK_PERIOD

        private static final int WRITE_SELECTOR_DEBUG_CHECK_PERIOD
        See Also:
        Constant Field Values
      • WRITE_SELECTOR_DEBUG_MAX_TIME

        private static final int WRITE_SELECTOR_DEBUG_MAX_TIME
        See Also:
        Constant Field Values
      • last_write_select_debug

        private long last_write_select_debug
      • last_select_debug

        private long last_select_debug
      • last_reopen_attempt

        private long last_reopen_attempt
    • Constructor Detail

      • VirtualChannelSelectorImpl

        public VirtualChannelSelectorImpl​(VirtualChannelSelector _parent,
                                          int _interest_op,
                                          boolean _pause_after_select,
                                          boolean _randomise_keys)
    • Method Detail

      • getSelector

        private static java.nio.channels.Selector getSelector()
                                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • openNewSelector

        protected java.nio.channels.Selector openNewSelector()
      • setRandomiseKeys

        public void setRandomiseKeys​(boolean r)
      • isPaused

        public boolean isPaused​(java.nio.channels.spi.AbstractSelectableChannel channel)
      • pauseSelects

        public void pauseSelects​(java.nio.channels.spi.AbstractSelectableChannel channel)
      • resumeSelects

        public void resumeSelects​(java.nio.channels.spi.AbstractSelectableChannel channel)
      • isRegistered

        public boolean isRegistered​(java.nio.channels.spi.AbstractSelectableChannel channel)
      • cancel

        public void cancel​(java.nio.channels.spi.AbstractSelectableChannel channel)
      • select

        public int select​(long timeout)
      • destroy

        public void destroy()
        Note that you have to ensure that a select operation is performed on the normal select loop *after* destroying the selector to actually cause the destroy to occur
      • closeExistingSelector

        protected void closeExistingSelector()