SelectorHandler
| Modifier and Type | Field and Description |
|---|---|
| private Queue | |
| private volatile int | |
| private int | |
| private final Queue | |
| pack-priv volatile boolean | |
| private boolean | |
| private Iterator | |
| private SelectionKey | |
| private int | |
| private int | |
| private long | lastSpinTimestamp
Selector spin discovering |
| private static final Logger | |
| private final Queue | |
| private final Queue | |
| private Set | |
| private final AtomicInteger | |
| private Selector | |
| private Thread | |
| private final AtomicBoolean | |
| private final Map | |
| private final AtomicReference | |
| private static final String | |
| private final NIOTransport |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| pack-priv void | |
| private void | |
| pack-priv SelectionKey | |
| pack-priv void | |
| public static SelectorRunner | |
| protected boolean | doSelect()
This method handle the processing of all Selector's interest op (OP_ACCEPT,OP_READ,OP_WRITE,OP_CONNECT) by delegating to its Handler. |
| private void | dropConnectionDueToException(final SelectionKey
SelectionKey, which was processed, when the Exception occurrederror description description, final Exception Exception occurredlogger runLogLevel, final Level Level to use, if transport is in running statelogger stoppedLogLevel)Level to use, if transport is not in running stateNotify transport about the |
| public int | Returns: number ofSelectionKeys, which were selected last time.Number of |
| public Queue | |
| public Queue | |
| public Thread | |
| public Selector | |
| public Transport. | |
| public NIOTransport | |
| pack-priv int | Returns: current spin rate (emptyspins/sec).Increments spin counter and returns current spin rate (emptyspins/sec). |
| private boolean | |
| pack-priv boolean | |
| private boolean | |
| private boolean | |
| public Queue | |
| public void | |
| private void | |
| pack-priv void | |
| public void | |
| private void | |
| pack-priv void | setSelector(final Selector
the new selector)Selector to be associated with this SelectorRunner.Sets the |
| private void | |
| public synchronized void | |
| public synchronized void | |
| protected void | |
| private void | |
| pack-priv void |
| currentPostponedTasks | back to summary |
|---|---|
| private Queue<SelectorHandlerTask> currentPostponedTasks | |
| dumbVolatile | back to summary |
|---|---|
| private volatile int dumbVolatile | |
| emptySpinCounter | back to summary |
|---|---|
| private int emptySpinCounter | |
| evenPostponedTasks | back to summary |
|---|---|
| private final Queue<SelectorHandlerTask> evenPostponedTasks | |
| hasPendingTasks | back to summary |
|---|---|
| pack-priv volatile boolean hasPendingTasks | |
| isResume | back to summary |
|---|---|
| private boolean isResume | |
| iterator | back to summary |
|---|---|
| private Iterator<SelectionKey> iterator | |
| key | back to summary |
|---|---|
| private SelectionKey key | |
| keyReadyOps | back to summary |
|---|---|
| private int keyReadyOps | |
| lastSelectedKeysCount | back to summary |
|---|---|
| private int lastSelectedKeysCount | |
| lastSpinTimestamp | back to summary |
|---|---|
| private long lastSpinTimestamp Selector spin discovering | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| oddPostponedTasks | back to summary |
|---|---|
| private final Queue<SelectorHandlerTask> oddPostponedTasks | |
| pendingTasks | back to summary |
|---|---|
| private final Queue<SelectorHandlerTask> pendingTasks | |
| readyKeySet | back to summary |
|---|---|
| private Set<SelectionKey> readyKeySet | |
| runnerThreadActivityCounter | back to summary |
|---|---|
| private final AtomicInteger runnerThreadActivityCounter | |
| selector | back to summary |
|---|---|
| private Selector selector | |
| selectorRunnerThread | back to summary |
|---|---|
| private Thread selectorRunnerThread | |
| selectorWakeupFlag | back to summary |
|---|---|
| private final AtomicBoolean selectorWakeupFlag | |
| spinnedSelectorsHistory | back to summary |
|---|---|
| private final Map<Selector, Long> spinnedSelectorsHistory | |
| stateHolder | back to summary |
|---|---|
| private final AtomicReference<Transport. | |
| THREAD_MARKER | back to summary |
|---|---|
| private static final String THREAD_MARKER | |
| transport | back to summary |
|---|---|
| private final NIOTransport transport | |
| SelectorRunner | back to summary |
|---|---|
| private SelectorRunner(final NIOTransport transport, final Selector selector) | |
| abortTasksInQueue | back to summary |
|---|---|
| private void abortTasksInQueue(final Queue<SelectorHandlerTask> taskQueue) | |
| addPendingTask | back to summary |
|---|---|
| pack-priv void addPendingTask(final SelectorHandlerTask task) | |
| addThreadNameMarker | back to summary |
|---|---|
| private void addThreadNameMarker(final Thread currentThread) | |
| checkIfSpinnedKey | back to summary |
|---|---|
| pack-priv SelectionKey checkIfSpinnedKey(final SelectionKey key) | |
| checkSelectorSpin | back to summary |
|---|---|
| pack-priv void checkSelectorSpin(final boolean hasSelectedKeys, final int spinRateThreshold) throws IOException | |
| create | back to summary |
|---|---|
| public static SelectorRunner create(final NIOTransport transport) throws IOException | |
| doSelect | back to summary |
|---|---|
| protected boolean doSelect() This method handle the processing of all Selector's interest op (OP_ACCEPT,OP_READ,OP_WRITE,OP_CONNECT) by delegating to its Handler. By default, all java.nio.channels.Selector operations are implemented using SelectorHandler. All SelectionKey operations are implemented by SelectionKeyHandler. Finally, ProtocolChain creation/re-use are implemented by InstanceHandler. | |
| dropConnectionDueToException | back to summary |
|---|---|
| private void dropConnectionDueToException(final SelectionKey key, final String description, final Exception e, final Level runLogLevel, final Level stoppedLogLevel) Notify transport about the
| |
| getLastSelectedKeysCount | back to summary |
|---|---|
| public int getLastSelectedKeysCount() Number of
| |
| getPendingTasks | back to summary |
|---|---|
| public Queue | |
| getPostponedTasks | back to summary |
|---|---|
| public Queue | |
| getRunnerThread | back to summary |
|---|---|
| public Thread getRunnerThread() | |
| getSelector | back to summary |
|---|---|
| public Selector getSelector() | |
| getState | back to summary |
|---|---|
| public Transport. | |
| getTransport | back to summary |
|---|---|
| public NIOTransport getTransport() | |
| incSpinCounter | back to summary |
|---|---|
| pack-priv int incSpinCounter() Increments spin counter and returns current spin rate (emptyspins/sec).
| |
| isRunning | back to summary |
|---|---|
| private boolean isRunning() | |
| isStop | back to summary |
|---|---|
| pack-priv boolean isStop() | |
| iterateKeyEvents | back to summary |
|---|---|
| private boolean iterateKeyEvents() throws IOException | |
| iterateKeys | back to summary |
|---|---|
| private boolean iterateKeys() | |
| obtainPostponedTasks | back to summary |
|---|---|
| public Queue | |
| postpone | back to summary |
|---|---|
| public void postpone() | |
| removeThreadNameMarker | back to summary |
|---|---|
| private void removeThreadNameMarker(final Thread currentThread) | |
| resetSpinCounter | back to summary |
|---|---|
| pack-priv void resetSpinCounter() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| setRunnerThread | back to summary |
|---|---|
| private void setRunnerThread(final Thread runnerThread) | |
| setSelector | back to summary |
|---|---|
| pack-priv void setSelector(final Selector selector) Sets the
| |
| shutdownSelector | back to summary |
|---|---|
| private void shutdownSelector() | |
| start | back to summary |
|---|---|
| public synchronized void start() | |
| stop | back to summary |
|---|---|
| public synchronized void stop() | |
| switchToNewSelector | back to summary |
|---|---|
| protected void switchToNewSelector() throws IOException | |
| wakeupSelector | back to summary |
|---|---|
| private void wakeupSelector() | |
| workaroundSelectorSpin | back to summary |
|---|---|
| pack-priv void workaroundSelectorSpin() throws IOException | |