| | | | SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
|
|
com.newstep.solid.comm
All Implemented Interfaces:
Runnable
public class Multiplexor
The Multiplexor acts as IO processor and manages all IO operations requested
by the Channel. The IO operations are proccessed asynchronously. Usually
client applications does not require direct access to mutiplexor class, only
when multiple protocols would like to reuse the same multiplexor instance.
Each multiplexor instance instantiates one java.nio.channels.Selector
instance. Multiplexor represents a communications utility for providing
select functionality across multiple Channels and multiple
ChannelAccessPoints. Component implementations may configured to leverage the
Multiplexor construct in a manner most appropriate to the component's
communications requirements.
Implements:
Runnable
| Field Summary |
private LinkedList |
|
private ReentrantLock |
|
private ConcurrentHashMap |
|
private final static String |
|
private int |
|
private List |
|
private boolean |
|
private boolean |
|
private boolean |
|
private boolean |
|
private static Logger |
|
private int |
|
private int |
|
private int |
|
private int |
|
private int |
|
private Selector |
|
private Thread |
|
private long |
|
private ReentrantLock |
|
private int |
|
| Constructor Summary |
public void |
|
| Method Summary |
private void |
|
public void |
|
private void |
|
public synchronized boolean |
|
private void |
|
private void |
|
public synchronized void |
|
public void |
|
public void |
|
public synchronized void |
|
public synchronized void |
|
public synchronized void |
|
public String |
|
private LinkedList cancelledChannels
Multiplicity:
1
private ReentrantLock cancelledLock
Multiplicity:
1
private ConcurrentHashMap channels
Multiplicity:
1
private final static String className
Final.
Multiplicity:
1
Static.
private int closed
Multiplicity:
1
private List execCallbacks
Multiplicity:
1
private boolean hasCancelled
Multiplicity:
1
private boolean hasRegistred
Multiplicity:
1
private boolean isShutDown
Multiplicity:
1
private boolean isStopped
Multiplicity:
1
private static Logger logger
Multiplicity:
1
Static.
private int onAccept
Multiplicity:
1
private int onConnect
Multiplicity:
1
private int onRead
Multiplicity:
1
private int onWrite
Multiplicity:
1
private int registered
Multiplicity:
1
private Selector selector
Multiplicity:
1
private Thread selectorThread
Multiplicity:
1
private long selectTimeOut
Multiplicity:
1
private ReentrantLock shutDownLock
Multiplicity:
1
private int updates
Multiplicity:
1
public void Multiplexor ()
Stereotype:
create
private void attemptShutdown ()
public void cancelHandler (SelectableChannel channel)
Cancel the key if exists and close the channel
Parameters:
channel
SelectableChannel
Throws:
ChannelException
private void doShutDown ()
Shuts down the selector after it closes down all the channels.
public synchronized boolean isRunning ()
Synchronized.
private void processCancelations ()
private void processRegistrations ()
public synchronized void registerHandler (SelectableChannel selectableChannel, IOHandler callback)
Registers an IOHandler with the selector for the provided channel. The
interest operations are provided by the IOHandler. If the channel is
already it updates the interest operations.
Synchronized.
Throws:
ChannelException
public void run ()
The main work is done here. First we iterate through the list and
registers the new channels or just updates the interest operations. This
has to be done on the same thread as the select(). Then block on the
select. When there are ready keys available, call the appropiate IO
handler that processes them.
public void setLogLevel (Level logLevel)
public synchronized void shutDown (IOHandler handler)
Gracefully shuts down the selector
Parameters:
handler
Synchronized.
Throws:
ExecutableException
public synchronized void start ()
Synchronized.
Throws:
ChannelException
public synchronized void stop (IOHandler handler)
Stops the selector and cleans up
Parameters:
handler
Synchronized.
public String toString ()
| | | | SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
|
|