Class
Tree
          
PREV CLASS NEXT CLASS
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.comm.tcp
Class TCPChannelAccessPoint
com.newstep.solid.management.runtime.AsyncManagedExecutable
  |
  +--com.newstep.solid.comm.ChannelAccessPoint
       |
       +--com.newstep.solid.comm.tcp.TCPChannelAccessPoint
All Implemented Interfaces:
       IOHandler, ManagedExecutable

public class TCPChannelAccessPoint      
Implements a TCP ChannelAccessPoint. On the server side it binds its
transport endpoint(selectable channel) to a particular transport address
(host and port)and creates TCP server Channels. On the client side creates a
TCP client channel and returns it to the caller
Implements:
IOHandler
 
Links:
Kernel Association Association Link
to Class Multiplexor
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
 
Kernel Association Association Link
to Class ByteBufferPool
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
 
Generalization Generalization Link
to Class ChannelAccessPoint
Implements a TCP ChannelAccessPoint. On the server side it binds its
transport endpoint(selectable channel) to a particular transport address
(host and port)and creates TCP server Channels. On the client side creates a
TCP client channel and returns it to the caller
 
Implementation Implementation Link
to Interface IOHandler
Implements a TCP ChannelAccessPoint. On the server side it binds its
transport endpoint(selectable channel) to a particular transport address
(host and port)and creates TCP server Channels. On the client side creates a
TCP client channel and returns it to the caller
 
 

Field Summary
private int
private int
private final static String
private boolean
private boolean
private int
private ConcurrentHashMap
private static Logger
private Multiplexor
private int
private int
private boolean
private int
private boolean
private int
private int
Constructor Summary
public void
Method Summary
protected void
protected void
protected void
public int
public Channel
public int
private ServerSocketChannel
public int
public int
public void
public boolean
public void
listen(Address address, ChannelAccessPointListener listener, Integer nrConn)
public void
onAccept(SelectionKey key)
public void
onClosed(SelectableChannel channel)
public void
public void
public void
onRead(SelectionKey key)
public void
onWrite(SelectionKey key)
public Address
parseString(String string)
private void
setSocketOptions(Socket socket)
public void
public String
Field Detail
bufferPoolSize
private int bufferPoolSize
Multiplicity:
1
 

buffers
private ByteBufferPool buffers
Multiplicity:
1
 

bufferSize
private int bufferSize
Multiplicity:
1
 

className
private final static String className
Final.
Multiplicity:
1
Static.
 

inited
private boolean inited
Multiplicity:
1
 

keepAlive
private boolean keepAlive
Multiplicity:
1
 

linger
private int linger
Multiplicity:
1
 

listeners
private ConcurrentHashMap listeners
Multiplicity:
1
 

logger
private static Logger logger
Multiplicity:
1
Static.
 

mux
Multiplexor mux
 

mux
private Multiplexor mux
Multiplicity:
1
 

nrClients
private int nrClients
Multiplicity:
1
 

nrServers
private int nrServers
Multiplicity:
1
 

oobInline
private boolean oobInline
Multiplicity:
1
 

rcvBuf
private int rcvBuf
Multiplicity:
1
 

reuseAddr
private boolean reuseAddr
Multiplicity:
1
 

sndBuf
private int sndBuf
Multiplicity:
1
 

tos
private int tos
Multiplicity:
1
 
Constructor Detail
TCPChannelAccessPoint
public void TCPChannelAccessPoint (ChannelFactory channelFactory)
 
Constructor
Parameters:
channelFactory
ChannelFactory
Stereotype:
create
 
Method Detail
doShutdown
protected void doShutdown ()
 
Gracefully shuts down and propagates to the selector
Throws:
ExecutableException
 

doStart
protected void doStart ()
 
Starts the ChannelAccessPoint and the selector underneath
Throws:
ExecutableException
 

doStop
protected void doStop ()
 
Stops the ChannelAccessPoint and the selecytor underneath
 

getBufferCapacity
public int getBufferCapacity ()
 
Return the buffers capacity
Return:
int
 

getChannel
public Channel getChannel (Address address)
 
Returns a TCP channel that can be connected to the specified address
Parameters:
address
Address
Return:
Channel
Throws:
ChannelException
 

getInterestedOps
public int getInterestedOps ()
 
Return:
int the operations this IOHandler is interested in
 

getListeningChannel
private ServerSocketChannel getListeningChannel (Address address)
 
Returns the ChannelAccessPoint listener for a specified address
Parameters:
address
Address
Return:
ServerSocketChannel
 

getMux
public Multiplexor getMux ()
 
Return the MUX processing this channel
Return:
Multiplexor
 

getNrClientChannels
public int getNrClientChannels ()
 
Returns the number of client channels this access point has created
Return:
TODO
 

getNrServerChannels
public int getNrServerChannels ()
 
Return the number of server channels this access point has created
Return:
TODO
 

init
public void init (CommConfig config)
 
TCP channels configuration
 

isListening
public boolean isListening (Address address)
 
Checks if this channel access point is listening or not to a prticular
address
Parameters:
address
Return:
boolean
 

listen
public void listen (Address address, ChannelAccessPointListener listener, Integer nrConn)
 
Starts listening for nrConn connections at the specified address. If
there's a listener provided it adds it to its list and on accept for a
new connection it notifies it. Only one listener is accepted per address
If nrConn is 0, there will be un unlimited number of accepted connection.
Otherwise there will only be nrConn connections accepted
Parameters:
address
Address
listener
ChannelAccessPointListener
nrConn
int
Throws:
ChannelException
 

onAccept
public void onAccept (SelectionKey key)
 
IOHandler interface. This is the only valid IO operation the TCP
ChannelAccess Point implements. It accepts the incoming connection
request and it creates a new TCP channel Then it registers the newly
created TCP Channel with the selector for READ operations. It also
notifies its listener that a new channel has been created.
Parameters:
key
SelectionKey
Throws:
ChannelException
 

onClosed
public void onClosed (SelectableChannel channel)
 
Callback from the selector to notify when a channel is closed
 

onConnect
public void onConnect ()
 
IOHandler interface. Should be never called
Throws:
ChannelException
 

onDone
public void onDone ()
 
Callback for the selector to notify when it's closed
 

onRead
public void onRead (SelectionKey key)
 
IOHandler interface. Should never be called
Parameters:
key
SelectionKey
Throws:
ChannelException
 

onWrite
public void onWrite (SelectionKey key)
 
IOHandler interface. Should be never called
Throws:
ChannelException
 

parseString
public Address parseString (String string)
 
Parsses a string into an IP address
Throws:
ChannelException
 

setSocketOptions
private void setSocketOptions (Socket socket)
 
Throws:
SocketException
 

stopListen
public void stopListen (Address address)
 
Stops listening for connections at the specified address
Parameters:
address
Address
Throws:
ChannelException
 

toString
public String toString ()
 
 

Class
Tree
          
PREV CLASS NEXT CLASS
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD