Top Description Fields Constructors Methods
sun.nio.ch

pack-priv Class EPollSelectorImpl

extends SelectorImpl
Class Inheritance
Imports
java.io.IOException, java.nio.channels.ClosedSelectorException, .SelectionKey, .Selector, java.nio.channels.spi.SelectorProvider, java.util.ArrayDeque, .Deque, .HashMap, .Map, java.util.concurrent.TimeUnit, java.util.function.Consumer, jdk.internal.misc.Blocker

Linux epoll based Selector implementation

Field Summary

Modifier and TypeField and Description
private final int
private final EventFD
private final Map<Integer, SelectionKeyImpl>
private final Object
private boolean
private static final int
private final long
private final Deque<SelectionKeyImpl>
private final Object

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
protected int
doSelect(Consumer<SelectionKey>
the action to perform, can be null
action
,
long
timeout in milliseconds to wait, 0 to not wait, -1 to wait indefinitely
timeout
)

Implements abstract sun.nio.ch.SelectorImpl.doSelect.

Selects the keys for channels that are ready for I/O operations.

private void
protected void
implClose()

Implements abstract sun.nio.ch.SelectorImpl.implClose.

Invoked by implCloseSelector to close the selector.

protected void
implDereg(SelectionKeyImpl ski)

Implements abstract sun.nio.ch.SelectorImpl.implDereg.

Removes the key from the selector

private int
processEvents(int numEntries, Consumer<SelectionKey> action)

Process the polled events.

private void
processUpdateQueue()

Process changes to the interest ops.

public void
setEventOps(SelectionKeyImpl ski)

Implements abstract sun.nio.ch.SelectorImpl.setEventOps.

Invoked by interestOps to ensure the interest ops are updated at the next selection operation.

public Selector
wakeup()

Implements abstract java.nio.channels.Selector.wakeup.

Causes the first selection operation that has not yet returned to return immediately.

Inherited from sun.nio.ch.SelectorImpl:
begincancelendimplCloseSelectorimplRegisterkeysprocessDeregisterQueueprocessReadyEventsregisterselectselectselectselectselectedKeysselectNowselectNow

Field Detail

epfdback to summary
private final int epfd
eventfdback to summary
private final EventFD eventfd
fdToKeyback to summary
private final Map<Integer, SelectionKeyImpl> fdToKey
interruptLockback to summary
private final Object interruptLock
interruptTriggeredback to summary
private boolean interruptTriggered
NUM_EPOLLEVENTSback to summary
private static final int NUM_EPOLLEVENTS
pollArrayAddressback to summary
private final long pollArrayAddress
updateKeysback to summary
private final Deque<SelectionKeyImpl> updateKeys
updateLockback to summary
private final Object updateLock

Constructor Detail

EPollSelectorImplback to summary
pack-priv EPollSelectorImpl(SelectorProvider sp) throws IOException

Method Detail

clearInterruptback to summary
private void clearInterrupt() throws IOException
doSelectback to summary
protected int doSelect(Consumer<SelectionKey> action, long timeout) throws IOException

Implements abstract sun.nio.ch.SelectorImpl.doSelect.

Doc from sun.nio.ch.SelectorImpl.doSelect.

Selects the keys for channels that are ready for I/O operations.

Parameters
action:Consumer<SelectionKey>

the action to perform, can be null

timeout:long

timeout in milliseconds to wait, 0 to not wait, -1 to wait indefinitely

Annotations
@Override
ensureOpenback to summary
private void ensureOpen()

Hides sun.nio.ch.SelectorImpl.ensureOpen.

implCloseback to summary
protected void implClose() throws IOException

Implements abstract sun.nio.ch.SelectorImpl.implClose.

Doc from sun.nio.ch.SelectorImpl.implClose.

Invoked by implCloseSelector to close the selector.

Annotations
@Override
implDeregback to summary
protected void implDereg(SelectionKeyImpl ski) throws IOException

Implements abstract sun.nio.ch.SelectorImpl.implDereg.

Doc from sun.nio.ch.SelectorImpl.implDereg.

Removes the key from the selector

Annotations
@Override
processEventsback to summary
private int processEvents(int numEntries, Consumer<SelectionKey> action) throws IOException

Process the polled events. If the interrupt fd has been selected, drain it and clear the interrupt.

processUpdateQueueback to summary
private void processUpdateQueue()

Process changes to the interest ops.

setEventOpsback to summary
public void setEventOps(SelectionKeyImpl ski)

Implements abstract sun.nio.ch.SelectorImpl.setEventOps.

Doc from sun.nio.ch.SelectorImpl.setEventOps.

Invoked by interestOps to ensure the interest ops are updated at the next selection operation.

Annotations
@Override
wakeupback to summary
public Selector wakeup()

Implements abstract java.nio.channels.Selector.wakeup.

Doc from java.nio.channels.Selector.wakeup.

Causes the first selection operation that has not yet returned to return immediately.

If another thread is currently blocked in a selection operation then that invocation will return immediately. If no selection operation is currently in progress then the next invocation of a selection operation will return immediately unless selectNow() or selectNow(Consumer) is invoked in the meantime. In any case the value returned by that invocation may be non-zero. Subsequent selection operations will block as usual unless this method is invoked again in the meantime.

Invoking this method more than once between two successive selection operations has the same effect as invoking it just once.

Returns:Selector

This selector

Annotations
@Override