barchart-udt-core
2.3.0-SNAPSHOT / 2013-05-13T01:37:38.485-0500

com.barchart.udt.nio
Class SelectorUDT

java.lang.Object
  extended by java.nio.channels.Selector
      extended by java.nio.channels.spi.AbstractSelector
          extended by com.barchart.udt.nio.SelectorUDT

public class SelectorUDT
extends AbstractSelector

selector

design guidelines:

1) follow general contracts of jdk 6 nio; see barchart-udt-reference-jdk6

2) adapt to how netty is doing select; see NioEventLoop

note: you must use SelectorProviderUDT.openSelector() to obtain instance of this class; do not use JDK Selector.open()


Field Summary
protected static org.slf4j.Logger log
           
 int maximimSelectorSize
           
 
Constructor Summary
protected SelectorUDT(SelectorProvider provider, int maximumSelectorSize)
           
 
Method Summary
protected  void cancel(SelectionKeyUDT keyUDT)
          Enqueue cancel request.
protected  void doCancel()
          Process pending cancel requests.
protected  int doEpollEnter(long millisTimeout)
           
protected  int doEpollExclusive(long millisTimeout)
           
protected  int doEpollSelect(long millisTimeout)
           
protected  int doEpollSelectUDT(long timeout)
           
protected  void doResults()
           
protected  void doResultsRead(int resultIndex)
           
protected  void doResultsWrite(int resultIndex)
           
protected  EpollUDT epollUDT()
           
protected  void implCloseSelector()
           
 Set<SelectionKey> keys()
           
protected  void logSocketId(String title, int socketId)
           
protected static Selector open(TypeUDT type)
          use this call to instantiate a selector for UDT
protected  SelectionKey register(AbstractSelectableChannel channel, int interestOps, Object attachment)
           
 int select()
           
 int select(long timeout)
           
 Set<SelectionKey> selectedKeys()
           
 int selectNow()
           
 Selector wakeup()
           
protected  boolean wakeupIsPending()
           
protected  void wakeupMarkBase()
           
 
Methods inherited from class java.nio.channels.spi.AbstractSelector
begin, cancelledKeys, close, deregister, end, isOpen, provider
 
Methods inherited from class java.nio.channels.Selector
open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.slf4j.Logger log

maximimSelectorSize

public final int maximimSelectorSize
Constructor Detail

SelectorUDT

protected SelectorUDT(SelectorProvider provider,
                      int maximumSelectorSize)
               throws ExceptionUDT
Throws:
ExceptionUDT
Method Detail

open

protected static Selector open(TypeUDT type)
                        throws IOException
use this call to instantiate a selector for UDT

Throws:
IOException

cancel

protected void cancel(SelectionKeyUDT keyUDT)
Enqueue cancel request.


doCancel

protected void doCancel()
Process pending cancel requests.


doEpollEnter

protected int doEpollEnter(long millisTimeout)
                    throws IOException
Parameters:
millisTimeout - <0 : invinite; =0 : immediate; >0 : finite;
Throws:
IOException

doEpollExclusive

protected int doEpollExclusive(long millisTimeout)
                        throws IOException
Parameters:
millisTimeout - <0 : invinite; =0 : immediate; >0 : finite;
Returns:
<0 : should not happen =0 : means nothing was selected/timeout >0 : number of selected keys
Throws:
IOException

doEpollSelect

protected int doEpollSelect(long millisTimeout)
                     throws ExceptionUDT
Parameters:
millisTimeout - <0 : infinite =0 : immediate >0 : finite
Throws:
ExceptionUDT

doEpollSelectUDT

protected int doEpollSelectUDT(long timeout)
                        throws ExceptionUDT
Throws:
ExceptionUDT

doResults

protected void doResults()

doResultsRead

protected void doResultsRead(int resultIndex)

doResultsWrite

protected void doResultsWrite(int resultIndex)

epollUDT

protected EpollUDT epollUDT()

implCloseSelector

protected void implCloseSelector()
                          throws IOException
Specified by:
implCloseSelector in class AbstractSelector
Throws:
IOException

keys

public Set<SelectionKey> keys()
Specified by:
keys in class Selector

logSocketId

protected void logSocketId(String title,
                           int socketId)

register

protected SelectionKey register(AbstractSelectableChannel channel,
                                int interestOps,
                                Object attachment)
Specified by:
register in class AbstractSelector

select

public int select()
           throws IOException
Specified by:
select in class Selector
Throws:
IOException

select

public int select(long timeout)
           throws IOException
Specified by:
select in class Selector
Throws:
IOException

selectedKeys

public Set<SelectionKey> selectedKeys()
Specified by:
selectedKeys in class Selector

selectNow

public int selectNow()
              throws IOException
Specified by:
selectNow in class Selector
Throws:
IOException

wakeup

public Selector wakeup()
Specified by:
wakeup in class Selector

wakeupIsPending

protected boolean wakeupIsPending()

wakeupMarkBase

protected void wakeupMarkBase()

barchart-udt-core
2.3.0-SNAPSHOT / 2013-05-13T01:37:38.485-0500

Copyright © 2009-2013 Barchart, Inc.. All Rights Reserved.