Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.netio.niowrapper
Class SelectorThread
java.lang.Thread
  |
  +--com.newstep.solid.netio.niowrapper.SelectorThread
All Implemented Interfaces:
       Runnable

public class SelectorThread      
A thread that wraps a java.nio.channels.Selector and services selected keys.
getStartStopLatch MUST be invoked prior to starting this thread. The returned
CountDownLatch may be used to await for thread's startup.
 
Links:
Kernel Association Association Link
to Interface SelectorListener
Associates type:
aggregation
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Directed.
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
Custom properties
associates:
com.newstep.solid.netio.niowrapper.SelectorListener
link:
aggregation
 
 

Field Summary
CountDownLatch
protected final static String
protected static Logger
private boolean
private Selector
private CountDownLatch
private ReentrantLock
private ArrayList
Constructor Summary
public void
SelectorThread(String name)
Method Summary
public void
addChannelInterest(SelectableChannel channel, Integer interest)
public void
deregisterChannel(SelectableChannel channel)
public CountDownLatch
public void
registerChannel(SelectableChannel channel, Integer interest, SelectorListener listener)
public void
removeChannelInterest(SelectableChannel channel, Integer interest)
public void
run()
private void
scheduleChannelDeregistration(SelectableChannel channel)
private void
scheduleChannelRegistration(SelectableChannel channel, Integer interest, SelectorListener listener)
private void
scheduleKeysUpdate(SelectionKey sKey, Integer newInterest)
public void
protected void
updateKeys(SelectionKey sKey, Integer newInterest)
Field Detail
className
protected final static String className
Final.
Multiplicity:
1
Static.
 

logger
protected static Logger logger
Multiplicity:
1
Static.
 

running
private boolean running
Multiplicity:
1
 

selector
private Selector selector
Multiplicity:
1
 

startStopLatch
private CountDownLatch startStopLatch
Multiplicity:
1
 

startStopLatch
CountDownLatch startStopLatch
 

taskLock
private ReentrantLock taskLock
Multiplicity:
1
 

tasks
private ArrayList tasks
Multiplicity:
1
Custom properties
associates:
com.newstep.solid.netio.niowrapper.SelectorListener
 
Constructor Detail
SelectorThread
public void SelectorThread (String name)
 
Stereotype:
create
 
Method Detail
addChannelInterest
public void addChannelInterest (SelectableChannel channel, Integer interest)
 
 

deregisterChannel
public void deregisterChannel (SelectableChannel channel)
 
 

getStartStopLatch
public CountDownLatch getStartStopLatch ()
 
This operation MUST be invoked before starting the thread. The returned
latch can be used to await for the thread to start or exit after invoking
stopSelector method.
Return:
countDownLatch to await on while the trhead starts or exits
 

registerChannel
public void registerChannel (SelectableChannel channel, Integer interest, SelectorListener listener)
 
Throws:
IOException
 

removeChannelInterest
public void removeChannelInterest (SelectableChannel channel, Integer interest)
 
 

run
public void run ()
 
 

scheduleChannelDeregistration
private void scheduleChannelDeregistration (SelectableChannel channel)
 
 

scheduleChannelRegistration
private void scheduleChannelRegistration (SelectableChannel channel, Integer interest, SelectorListener listener)
 
 

scheduleKeysUpdate
private void scheduleKeysUpdate (SelectionKey sKey, Integer newInterest)
 
 

stopSelector
public void stopSelector ()
 
 

updateKeys
protected void updateKeys (SelectionKey sKey, Integer newInterest)
 
 

Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD