public interface Poller
Modifier and Type | Method and Description |
---|---|
boolean |
disable(SelectableChannel channel)
Disable a channel in the poller, preventing it from waking up the thread
when messages are received on it.
|
boolean |
disable(Socket socket)
Disable a socket in the poller, preventing it from waking up the thread
when messages are received on it.
|
int |
enable(SelectableChannel channel)
Enable a channel in the poller after it has been disabled.
|
int |
enable(Socket socket)
Enable a socket in the poller after it has been disabled.
|
void |
poll()
Poll a socket indefinitely.
|
void |
poll(long timeoutMillis)
Poll a socket for a given amount of time.
|
int |
register(Pollable pollable,
PollListener listener)
Register a new poll item.
|
boolean |
unregister(SelectableChannel channel)
Unregister a channel from the poller.
|
boolean |
unregister(Socket socket)
Unregister a socket from the poller.
|
void poll()
void poll(long timeoutMillis)
timeoutMillis
- The number of milliseconds to wait before returningint enable(Socket socket)
socket
- The socket registered with the poller to be enabledboolean disable(Socket socket)
socket
- The socket registered with the poller to be disabledint enable(SelectableChannel channel)
channel
- The channel registered with the poller to be enabledboolean disable(SelectableChannel channel)
channel
- The channel registered with the poller to be disabledint register(Pollable pollable, PollListener listener)
pollable
- The pollable containing the socket and polling optionslistener
- The listener that handles events for the given pollableboolean unregister(Socket socket)
socket
- The socket registered with the poller to be unregisteredboolean unregister(SelectableChannel channel)
channel
- The channel registered with the poller to be unregisteredCopyright © 2019. All rights reserved.