| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmirrormap.lifecycle.AbstractLifeCycle
mirrormap.nio.TcpConnectionEndPoint
public final class TcpConnectionEndPoint
Handles the socket processing for a TCP end point.
| Constructor Summary | |
|---|---|
| TcpConnectionEndPoint(IConnectionEndPointReceiver receiver,
                      SelectorTasks selectorTasks,
                      Executor writer,
                      String host,
                      int port)Standard constructor for a TCP end point. | |
| Method Summary | |
|---|---|
| protected  void | doDestroy()Destroy the internal TCP I/O components. | 
| protected  void | doStart()Overridden in subclasses to perform custom logic on activation. | 
|  IConnectionEndPointReceiver | getReceiver()The object handling the inbound data for the connection | 
| protected  SocketChannel | getSocketChannel() | 
|  boolean | isConnected() | 
|  boolean | isOutbound()Indicates the connecting direction. | 
|  void | run()Run the task associated with the operation and selection key | 
|  void | send(byte[] data)Add the data to the pending messages list | 
|  void | setSelectionKey(SelectionKey selectionKey)Receives the selection key returned from the SelectableChannel.register(java.nio.channels.Selector, int)method called during theSelectorTasks.register(int, SelectableChannel, ISelectionKeyTask)method. | 
|  String | toString() | 
| Methods inherited from class mirrormap.lifecycle.AbstractLifeCycle | 
|---|
| checkActive, destroy, finalize, isActive, start | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface mirrormap.lifecycle.ILifeCycle | 
|---|
| isActive, start | 
| Methods inherited from interface mirrormap.lifecycle.IDestroyable | 
|---|
| destroy | 
| Constructor Detail | 
|---|
public TcpConnectionEndPoint(IConnectionEndPointReceiver receiver,
                             SelectorTasks selectorTasks,
                             Executor writer,
                             String host,
                             int port)
receiver - the object that will handle data received from the remote end
            pointselectorTasks - used to register and unregister this end point against the
            SelectionKey of the underlying
            SelectableChannel backing this end pointwriter - handles writing data, optional. If null then the
            Thread running the SelectorTasks.process()
            method will do the writinghost - the IP address or resolvable host name of the other end pointport - the TCP port for the socket connection of the other end point
IllegalStateException - if the socket could not be constructed| Method Detail | 
|---|
public void send(byte[] data)
send in interface IConnectionEndPointdata - the data to add to the pending messagespublic IConnectionEndPointReceiver getReceiver()
IConnectionEndPoint
getReceiver in interface IConnectionEndPointprotected void doStart()
AbstractLifeCycleRuntimeException or subclass
 thereof. When this method is called, the AbstractLifeCycle.isActive() method will
 return true.
doStart in class AbstractLifeCyclepublic boolean isConnected()
public boolean isOutbound()
isOutbound in interface IConnectionEndPointtrue if this socket connects to a server socket,
         false if it was an inbound connection from another
         end pointprotected void doDestroy()
doDestroy in class AbstractLifeCycleprotected SocketChannel getSocketChannel()
public String toString()
toString in class AbstractLifeCyclepublic void run()
ISelectionKeyTask
run in interface ISelectionKeyTaskpublic void setSelectionKey(SelectionKey selectionKey)
ISelectionKeyTaskSelectableChannel.register(java.nio.channels.Selector, int)
 method called during the
 SelectorTasks.register(int, SelectableChannel, ISelectionKeyTask)
 method. This is the key associated with this task.
setSelectionKey in interface ISelectionKeyTaskselectionKey - the selection key associated with this task| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||