| | | | SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
|
|
com.newstep.solid.comm.tcp
|
Class TCPChannelAccessPoint
|
|
|
+--com.newstep.solid.comm.tcp.TCPChannelAccessPoint
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
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
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
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
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 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 int |
|
private ServerSocketChannel |
|
|
|
public int |
|
public int |
|
public void |
|
public boolean |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
|
|
private void |
|
public void |
|
public String |
|
private int bufferPoolSize
Multiplicity:
1
Multiplicity:
1
private int bufferSize
Multiplicity:
1
private final static String className
Final.
Multiplicity:
1
Static.
private boolean inited
Multiplicity:
1
private boolean keepAlive
Multiplicity:
1
private int linger
Multiplicity:
1
private ConcurrentHashMap listeners
Multiplicity:
1
private static Logger logger
Multiplicity:
1
Static.
Multiplicity:
1
private int nrClients
Multiplicity:
1
private int nrServers
Multiplicity:
1
private boolean oobInline
Multiplicity:
1
private int rcvBuf
Multiplicity:
1
private boolean reuseAddr
Multiplicity:
1
private int sndBuf
Multiplicity:
1
private int tos
Multiplicity:
1
Constructor
Parameters:
channelFactory
ChannelFactory
Stereotype:
create
protected void doShutdown ()
Gracefully shuts down and propagates to the selector
Throws:
ExecutableException
protected void doStart ()
Starts the ChannelAccessPoint and the selector underneath
Throws:
ExecutableException
protected void doStop ()
Stops the ChannelAccessPoint and the selecytor underneath
public int getBufferCapacity ()
Return the buffers capacity
Return:
int
Returns a TCP channel that can be connected to the specified address
Parameters:
address
Address
Return:
Channel
Throws:
ChannelException
public int getInterestedOps ()
Return:
int the operations this IOHandler is interested in
private ServerSocketChannel getListeningChannel (Address address)
Returns the ChannelAccessPoint listener for a specified address
Parameters:
address
Address
Return:
ServerSocketChannel
Return the MUX processing this channel
Return:
Multiplexor
public int getNrClientChannels ()
Returns the number of client channels this access point has created
Return:
TODO
public int getNrServerChannels ()
Return the number of server channels this access point has created
Return:
TODO
TCP channels configuration
public boolean isListening (Address address)
Checks if this channel access point is listening or not to a prticular
address
Parameters:
address
Return:
boolean
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
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
public void onClosed (SelectableChannel channel)
Callback from the selector to notify when a channel is closed
public void onConnect ()
IOHandler interface. Should be never called
Throws:
ChannelException
public void onDone ()
Callback for the selector to notify when it's closed
public void onRead (SelectionKey key)
IOHandler interface. Should never be called
Parameters:
key
SelectionKey
Throws:
ChannelException
public void onWrite (SelectionKey key)
IOHandler interface. Should be never called
Throws:
ChannelException
public Address parseString (String string)
Parsses a string into an IP address
Throws:
ChannelException
private void setSocketOptions (Socket socket)
Throws:
SocketException
public void stopListen (Address address)
Stops listening for connections at the specified address
Parameters:
address
Address
Throws:
ChannelException
public String toString ()
| | | | SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
|
|