public class DefaultSelectorHandler extends Object implements SelectorHandler
SelectorHandler| Modifier and Type | Class and Description |
|---|---|
protected static class |
DefaultSelectorHandler.DeregisterChannelOperation |
protected static class |
DefaultSelectorHandler.RegisterChannelOperation |
protected static class |
DefaultSelectorHandler.RegisterKeyTask |
protected static class |
DefaultSelectorHandler.RunnableTask |
SelectorHandler.Task| Modifier and Type | Field and Description |
|---|---|
static boolean |
IS_WORKAROUND_SELECTOR_SPIN |
protected long |
selectTimeout |
DEFAULT_SELECTOR_HANDLER| Constructor and Description |
|---|
DefaultSelectorHandler() |
DefaultSelectorHandler(long selectTimeout,
TimeUnit timeunit) |
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterChannel(SelectorRunner selectorRunner,
SelectableChannel channel)
Deregister the channel from the
SelectorRunner's Selector. |
void |
deregisterChannelAsync(SelectorRunner selectorRunner,
SelectableChannel channel,
CompletionHandler<RegisterChannelResult> completionHandler)
Deregister the channel from the
SelectorRunner's Selector. |
void |
deregisterKeyInterest(SelectorRunner selectorRunner,
SelectionKey key,
int interest)
Deregisters SelectionKey interest.
|
void |
enque(SelectorRunner selectorRunner,
SelectorHandler.Task task,
CompletionHandler<SelectorHandler.Task> completionHandler)
Execute task in a selector thread.
|
void |
execute(SelectorRunner selectorRunner,
SelectorHandler.Task task,
CompletionHandler<SelectorHandler.Task> completionHandler)
Execute task in a selector thread.
|
long |
getSelectTimeout() |
boolean |
onSelectorClosed(SelectorRunner selectorRunner) |
void |
postSelect(SelectorRunner selectorRunner) |
boolean |
preSelect(SelectorRunner selectorRunner) |
void |
registerChannel(SelectorRunner selectorRunner,
SelectableChannel channel,
int interest,
Object attachment) |
void |
registerChannelAsync(SelectorRunner selectorRunner,
SelectableChannel channel,
int interest,
Object attachment,
CompletionHandler<RegisterChannelResult> completionHandler) |
void |
registerKeyInterest(SelectorRunner selectorRunner,
SelectionKey key,
int interest) |
Set<SelectionKey> |
select(SelectorRunner selectorRunner) |
public static final boolean IS_WORKAROUND_SELECTOR_SPIN
protected final long selectTimeout
public DefaultSelectorHandler()
public DefaultSelectorHandler(long selectTimeout,
TimeUnit timeunit)
public long getSelectTimeout()
getSelectTimeout in interface SelectorHandlerpublic boolean preSelect(SelectorRunner selectorRunner) throws IOException
preSelect in interface SelectorHandlerIOExceptionpublic Set<SelectionKey> select(SelectorRunner selectorRunner) throws IOException
select in interface SelectorHandlerIOExceptionpublic void postSelect(SelectorRunner selectorRunner) throws IOException
postSelect in interface SelectorHandlerIOExceptionpublic void registerKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) throws IOException
registerKeyInterest in interface SelectorHandlerIOExceptionpublic void deregisterKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) throws IOException
deregisterKeyInterest in interface SelectorHandlerIOExceptionpublic void registerChannel(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment) throws IOException
registerChannel in interface SelectorHandlerIOExceptionpublic void registerChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)
registerChannelAsync in interface SelectorHandlerpublic void deregisterChannel(SelectorRunner selectorRunner, SelectableChannel channel) throws IOException
SelectorHandlerSelectorRunner's Selector.deregisterChannel in interface SelectorHandlerselectorRunner - SelectorRunnerchannel - SelectableChannel channel to deregisterIOExceptionpublic void deregisterChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, CompletionHandler<RegisterChannelResult> completionHandler)
SelectorHandlerSelectorRunner's Selector.deregisterChannelAsync in interface SelectorHandlerselectorRunner - SelectorRunnerchannel - SelectableChannel channel to deregistercompletionHandler - CompletionHandlerpublic void execute(SelectorRunner selectorRunner, SelectorHandler.Task task, CompletionHandler<SelectorHandler.Task> completionHandler)
SelectorHandlerSelectorHandler.enque(org.glassfish.grizzly.nio.SelectorRunner, org.glassfish.grizzly.nio.SelectorHandler.Task, org.glassfish.grizzly.CompletionHandler),
this operation will execute the task immediately if the current
is a selector thread.execute in interface SelectorHandlerpublic void enque(SelectorRunner selectorRunner, SelectorHandler.Task task, CompletionHandler<SelectorHandler.Task> completionHandler)
SelectorHandlerSelectorHandler.execute(org.glassfish.grizzly.nio.SelectorRunner, org.glassfish.grizzly.nio.SelectorHandler.Task, org.glassfish.grizzly.CompletionHandler),
this operation will postpone the task execution if current thread
is a selector thread, and execute it during the next
SelectorHandler.select(org.glassfish.grizzly.nio.SelectorRunner) iteration.enque in interface SelectorHandlerpublic boolean onSelectorClosed(SelectorRunner selectorRunner)
onSelectorClosed in interface SelectorHandlerCopyright © 2017–2019 Oracle Corporation. All rights reserved.