com.sun.grizzly.nio
Class SelectorRunner
java.lang.Object
com.sun.grizzly.nio.SelectorRunner
- All Implemented Interfaces:
- Runnable
public class SelectorRunner
- extends Object
- implements Runnable
Class is responsible for processing certain (single) SelectorHandler
- Author:
- Alexey Stashok
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SelectorRunner
public SelectorRunner(NIOTransport transport)
SelectorRunner
public SelectorRunner(NIOTransport transport,
Selector selector)
getTransport
public NIOTransport getTransport()
getSelector
public Selector getSelector()
setSelector
public void setSelector(Selector selector)
getRunnerThread
public Thread getRunnerThread()
getStateHolder
public StateHolder<Transport.State> getStateHolder()
getState
public Transport.State getState()
postpone
public void postpone()
start
public void start()
startBlocking
public void startBlocking(int timeout)
throws TimeoutException
- Throws:
TimeoutException
stop
public void stop()
stopBlocking
public void stopBlocking(int timeout)
throws TimeoutException
- Throws:
TimeoutException
wakeupSelector
public void wakeupSelector()
run
public void run()
- Specified by:
run in interface Runnable
doSelect
protected boolean doSelect()
- This method handle the processing of all Selector's interest op
(OP_ACCEPT,OP_READ,OP_WRITE,OP_CONNECT) by delegating to its Handler.
By default, all java.nio.channels.Selector operations are implemented
using SelectorHandler. All SelectionKey operations are implemented by
SelectionKeyHandler. Finally, ProtocolChain creation/re-use are implemented
by InstanceHandler.
- Parameters:
selectorHandler - - the SelectorHandler
getPendingOperations
public LinkedTransferQueue getPendingOperations()
getLastSelectedKeysCount
public int getLastSelectedKeysCount()
- Number of
SelectionKeys, which were selected last time.
Operation is not thread-safe.
- Returns:
- number of
SelectionKeys, which were selected last time.
Copyright © 2009 SUN Microsystems. All Rights Reserved.