Top Inners Fields Methods
org.glassfish.grizzly.nio

public Interface SelectorHandler

Known Direct Implementers
org.glassfish.grizzly.nio.DefaultSelectorHandler
Imports
java.io.IOException, java.nio.channels.SelectableChannel, .SelectionKey, java.util.Set, org.glassfish.grizzly.CompletionHandler

Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
public static final SelectorHandler
DEFAULT_SELECTOR_HANDLER

The default SelectorHandler used by all created builder instances.

Method Summary

Modifier and TypeMethod and Description
public void
deregisterChannel(SelectorRunner selectorRunner, SelectableChannel
SelectableChannel channel to deregister
channel
)

Deregister the channel from the SelectorRunner's Selector.

public void
deregisterChannelAsync(SelectorRunner selectorRunner, SelectableChannel
SelectableChannel channel to deregister
channel
,
CompletionHandler<RegisterChannelResult> completionHandler)

Deregister the channel from the SelectorRunner's Selector.

public void
deregisterKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest)

Deregisters SelectionKey interest.

public void
enque(final SelectorRunner selectorRunner, final SelectorHandler.Task task, final CompletionHandler<SelectorHandler.Task> completionHandler)

Execute task in a selector thread.

public void
execute(final SelectorRunner selectorRunner, final SelectorHandler.Task task, final CompletionHandler<SelectorHandler.Task> completionHandler)

Execute task in a selector thread.

public long
public boolean
public void
postSelect(SelectorRunner selectorRunner)

public boolean
preSelect(SelectorRunner selectorRunner)

public void
registerChannel(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment)

public void
registerChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)

public void
registerKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest)

public Set<SelectionKey>
select(SelectorRunner selectorRunner)

Field Detail

DEFAULT_SELECTOR_HANDLERback to summary
public static final SelectorHandler DEFAULT_SELECTOR_HANDLER

The default SelectorHandler used by all created builder instances.

Method Detail

deregisterChannelback to summary
public void deregisterChannel(SelectorRunner selectorRunner, SelectableChannel channel) throws IOException

Deregister the channel from the SelectorRunner's Selector.

Parameters
selectorRunner:SelectorRunner

SelectorRunner

channel:SelectableChannel

SelectableChannel channel to deregister

deregisterChannelAsyncback to summary
public void deregisterChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, CompletionHandler<RegisterChannelResult> completionHandler)

Deregister the channel from the SelectorRunner's Selector.

Parameters
selectorRunner:SelectorRunner

SelectorRunner

channel:SelectableChannel

SelectableChannel channel to deregister

completionHandler:CompletionHandler<RegisterChannelResult>

CompletionHandler

deregisterKeyInterestback to summary
public void deregisterKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) throws IOException

Deregisters SelectionKey interest. This method must be called from the SelectorRunner's thread only!

enqueback to summary
public void enque(final SelectorRunner selectorRunner, final SelectorHandler.Task task, final CompletionHandler<SelectorHandler.Task> completionHandler)

Execute task in a selector thread. Unlike 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 select(org.glassfish.grizzly.nio.SelectorRunner) iteration.

executeback to summary
public void execute(final SelectorRunner selectorRunner, final SelectorHandler.Task task, final CompletionHandler<SelectorHandler.Task> completionHandler)

Execute task in a selector thread. Unlike 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.

getSelectTimeoutback to summary
public long getSelectTimeout()
onSelectorClosedback to summary
public boolean onSelectorClosed(SelectorRunner selectorRunner)
postSelectback to summary
public void postSelect(SelectorRunner selectorRunner) throws IOException
preSelectback to summary
public boolean preSelect(SelectorRunner selectorRunner) throws IOException
registerChannelback to summary
public void registerChannel(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment) throws IOException
registerChannelAsyncback to summary
public void registerChannelAsync(SelectorRunner selectorRunner, SelectableChannel channel, int interest, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)
registerKeyInterestback to summary
public void registerKeyInterest(SelectorRunner selectorRunner, SelectionKey key, int interest) throws IOException
selectback to summary
public Set<SelectionKey> select(SelectorRunner selectorRunner) throws IOException
org.glassfish.grizzly.nio back to summary

public Interface SelectorHandler.Task


Method Summary

Modifier and TypeMethod and Description
public boolean
run()

Method Detail

runback to summary
public boolean run() throws Exception