- All Known Implementing Classes:
DefaultSelectorHandler
public interface SelectorHandler
- Author:
- Alexey Stashok
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SelectorHandlerThe defaultSelectorHandlerused by all created builder instances. -
Method Summary
Modifier and TypeMethodDescriptionvoidderegisterChannel(SelectorRunner selectorRunner, SelectableChannel channel) Deregister the channel from theSelectorRunner's Selector.voidderegisterChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, CompletionHandler<RegisterChannelResult> completionHandler) Deregister the channel from theSelectorRunner's Selector.voidderegisterKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) Deregisters SelectionKey interest.voidenque(SelectorRunner selectorRunner, SelectorHandler.Task task, CompletionHandler<SelectorHandler.Task> completionHandler) Execute task in a selector thread.voidexecute(SelectorRunner selectorRunner, SelectorHandler.Task task, CompletionHandler<SelectorHandler.Task> completionHandler) Execute task in a selector thread.longbooleanonSelectorClosed(SelectorRunner selectorRunner) voidpostSelect(SelectorRunner selectorRunner) booleanpreSelect(SelectorRunner selectorRunner) voidregisterChannel(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment) voidregisterChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler) voidregisterKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) select(SelectorRunner selectorRunner)
-
Field Details
-
DEFAULT_SELECTOR_HANDLER
The defaultSelectorHandlerused by all created builder instances.
-
-
Method Details
-
getSelectTimeout
long getSelectTimeout() -
preSelect
- Throws:
IOException
-
select
- Throws:
IOException
-
postSelect
- Throws:
IOException
-
registerKeyInterest
void registerKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) throws IOException - Throws:
IOException
-
deregisterKeyInterest
void deregisterKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) throws IOException Deregisters SelectionKey interest. This method must be called from the SelectorRunner's thread only!- Throws:
IOException
-
registerChannel
void registerChannel(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment) throws IOException - Throws:
IOException
-
registerChannelAsync
void registerChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler) -
deregisterChannel
Deregister the channel from theSelectorRunner's Selector.- Parameters:
selectorRunner-SelectorRunnerchannel-SelectableChannelchannel to deregister- Throws:
IOException
-
deregisterChannelAsync
void deregisterChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, CompletionHandler<RegisterChannelResult> completionHandler) Deregister the channel from theSelectorRunner's Selector.- Parameters:
selectorRunner-SelectorRunnerchannel-SelectableChannelchannel to deregistercompletionHandler-CompletionHandler
-
execute
void execute(SelectorRunner selectorRunner, SelectorHandler.Task task, CompletionHandler<SelectorHandler.Task> completionHandler) Execute task in a selector thread. Unlikeenque(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.- Parameters:
selectorRunner-task-completionHandler-
-
enque
void enque(SelectorRunner selectorRunner, SelectorHandler.Task task, CompletionHandler<SelectorHandler.Task> completionHandler) Execute task in a selector thread. Unlikeexecute(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 nextselect(org.glassfish.grizzly.nio.SelectorRunner)iteration.- Parameters:
selectorRunner-task-completionHandler-
-
onSelectorClosed
-