org.glassfish.grizzly.nio
Interface SelectorHandler

All Known Implementing Classes:
DefaultSelectorHandler

public interface SelectorHandler

Author:
Alexey Stashok

Nested Class Summary
static interface SelectorHandler.Task
           
 
Field Summary
static SelectorHandler DEFAULT_SELECTOR_HANDLER
          The default SelectorHandler used by all created builder instances.
 
Method Summary
 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)
           
 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)
           
 

Field Detail

DEFAULT_SELECTOR_HANDLER

static final SelectorHandler DEFAULT_SELECTOR_HANDLER
The default SelectorHandler used by all created builder instances.

Method Detail

getSelectTimeout

long getSelectTimeout()

preSelect

boolean preSelect(SelectorRunner selectorRunner)
                  throws IOException
Throws:
IOException

select

Set<SelectionKey> select(SelectorRunner selectorRunner)
                         throws IOException
Throws:
IOException

postSelect

void postSelect(SelectorRunner selectorRunner)
                throws IOException
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
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

void deregisterChannel(SelectorRunner selectorRunner,
                       SelectableChannel channel)
                       throws IOException
Deregister the channel from the SelectorRunner's Selector.

Parameters:
selectorRunner - SelectorRunner
channel - SelectableChannel channel to deregister
Throws:
IOException

deregisterChannelAsync

void deregisterChannelAsync(SelectorRunner selectorRunner,
                            SelectableChannel channel,
                            CompletionHandler<RegisterChannelResult> completionHandler)
Deregister the channel from the SelectorRunner's Selector.

Parameters:
selectorRunner - SelectorRunner
channel - SelectableChannel channel to deregister
completionHandler - CompletionHandler

execute

void execute(SelectorRunner selectorRunner,
             SelectorHandler.Task task,
             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.

Parameters:
selectorRunner -
task -
completionHandler -

enque

void enque(SelectorRunner selectorRunner,
           SelectorHandler.Task task,
           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.

Parameters:
selectorRunner -
task -
completionHandler -

onSelectorClosed

boolean onSelectorClosed(SelectorRunner selectorRunner)


Copyright © 2012 Oracle Corporation. All Rights Reserved.