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 int
private static final int
private PollSelectionKey[]
private final Map<SelectionKey,
Boolean> private int
private final int[]
private ByteBuffer
(package private) static final int
private static final int
(package private) static final int
(package private) static final int
(package private) static final int
private final Object
private static final int
private final Set<SelectionKey>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private short
getPollEvents
(int idx) private int
getPollFD
(int idx) private short
getPollRevents
(int idx) protected void
(package private) void
interestOps
(PollSelectionKey k, int ops) 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 SelectionKey
register
(AbstractSelectableChannel ch, int ops, Object att) private void
int
select()
int
select
(long timeout) int
wakeup()
private void
Methods 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:
implCloseSelector
in classAbstractSelector
- Throws:
IOException
-
register
- Specified by:
register
in classAbstractSelector
-
keys
-
selectedKeys
- Specified by:
selectedKeys
in classSelector
-
interestOps
-
add
-
remove
-
selectNow
- Specified by:
selectNow
in classSelector
- Throws:
IOException
-
select
- Specified by:
select
in classSelector
- Throws:
IOException
-
select
- Specified by:
select
in classSelector
- Throws:
IOException
-
poll
- Throws:
IOException
-
wakeupReceived
- Throws:
IOException
-
wakeup
-