Package jnr.enxio.channels
Class PollSelector
java.lang.Object
java.nio.channels.Selector
java.nio.channels.spi.AbstractSelector
jnr.enxio.channels.PollSelector
- All Implemented Interfaces:
Closeable,AutoCloseable
An implementation of a
Selector that uses good old
poll(2)-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate PollSelectionKey[]private final Map<SelectionKey, Boolean> private intprivate final int[]private ByteBuffer(package private) static final intprivate static final int(package private) static final int(package private) static final int(package private) static final intprivate final Objectprivate static final intprivate final Set<SelectionKey> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate shortgetPollEvents(int idx) private intgetPollFD(int idx) private shortgetPollRevents(int idx) protected void(package private) voidinterestOps(PollSelectionKey k, int ops) keys()private intpoll(long timeout) private voidputPollEvents(int idx, int events) private voidputPollFD(int idx, int fd) private voidputPollRevents(int idx, int events) protected SelectionKeyregister(AbstractSelectableChannel ch, int ops, Object att) private voidintselect()intselect(long timeout) intwakeup()private voidMethods inherited from class java.nio.channels.spi.AbstractSelector
begin, cancelledKeys, close, deregister, end, isOpen, provider
-
Field Details
-
POLLFD_SIZE
private static final int POLLFD_SIZE- See Also:
-
FD_OFFSET
private static final int FD_OFFSET- See Also:
-
EVENTS_OFFSET
private static final int EVENTS_OFFSET- See Also:
-
REVENTS_OFFSET
private static final int REVENTS_OFFSET- See Also:
-
POLLIN
static final int POLLIN- See Also:
-
POLLOUT
static final int POLLOUT- See Also:
-
POLLERR
static final int POLLERR- See Also:
-
POLLHUP
static final int POLLHUP- See Also:
-
keyArray
-
pollData
-
nfds
private int nfds -
pipefd
private final int[] pipefd -
regLock
-
keys
-
selected
-
-
Constructor Details
-
PollSelector
-
-
Method Details
-
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
- Specified by:
implCloseSelectorin classAbstractSelector- Throws:
IOException
-
register
- Specified by:
registerin classAbstractSelector
-
keys
-
selectedKeys
- Specified by:
selectedKeysin classSelector
-
interestOps
-
add
-
remove
-
selectNow
- Specified by:
selectNowin classSelector- Throws:
IOException
-
select
- Specified by:
selectin classSelector- Throws:
IOException
-
select
- Specified by:
selectin classSelector- Throws:
IOException
-
poll
- Throws:
IOException
-
wakeupReceived
- Throws:
IOException
-
wakeup
-