| | | | SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
|
|
com.newstep.solid.netio.packet
|
+--com.newstep.solid.netio.packet.PacketChannel
public class PacketChannel
Channel used to send and receive Packets. PacketChannel may be used in a
connection-less mode. PacketChannels created through the listen
function of the PacketChannelAccessPoint are not connected to a specific
remote endpoint. In connection-less mode the PacketChannel instance may
be used to send and receive packets from/to any remote endpoint by specifying
the remote endpoint in each packet's remoteEndpoint attribute.
Alternatively, the PacketChannel may implement a connection oriented scheme
when accessed via one of the PacketChannelAccessPoint.openChannel()
functions. In this mode the underlying DatagramChannel is connected to the
specified remoteEndpoint and may only send and receive packets from the
remote endpoint.
Implements:
DataIoListener
Links:
Kernel Association notifies closed
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Directed.
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
Kernel Association notifies
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Directed.
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
Kernel Association Association Link
the selector thread that manages the non-blocking DatagramChannel
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
Channel used to send and receive Packets. PacketChannel may be used in a
connection-less mode. PacketChannels created through the listen
function of the PacketChannelAccessPoint are not connected to a specific
remote endpoint. In connection-less mode the PacketChannel instance may
be used to send and receive packets from/to any remote endpoint by specifying
the remote endpoint in each packet's remoteEndpoint attribute.
Alternatively, the PacketChannel may implement a connection oriented scheme
when accessed via one of the PacketChannelAccessPoint.openChannel()
functions. In this mode the underlying DatagramChannel is connected to the
specified remoteEndpoint and may only send and receive packets from the
remote endpoint.
Implementation Implementation Link
Channel used to send and receive Packets. PacketChannel may be used in a
connection-less mode. PacketChannels created through the listen
function of the PacketChannelAccessPoint are not connected to a specific
remote endpoint. In connection-less mode the PacketChannel instance may
be used to send and receive packets from/to any remote endpoint by specifying
the remote endpoint in each packet's remoteEndpoint attribute.
Alternatively, the PacketChannel may implement a connection oriented scheme
when accessed via one of the PacketChannelAccessPoint.openChannel()
functions. In this mode the underlying DatagramChannel is connected to the
specified remoteEndpoint and may only send and receive packets from the
remote endpoint.
| Field Summary |
|
|
|
|
|
|
private final static String |
|
private DatagramChannel |
|
private final static Logger |
|
|
|
private ReentrantLock |
|
private ConcurrentLinkedQueue |
|
| Constructor Summary |
public void |
|
| Method Summary |
public void |
|
|
|
protected DatagramChannel |
|
|
|
|
|
public void |
|
public void |
|
public void |
|
public void |
|
Multiplicity:
1
Multiplicity:
1
private final static String CLASSNAME
Final.
Multiplicity:
1
Static.
private DatagramChannel datagramChannel
non-blocking DatagramChannel over which messages are sent and received
Multiplicity:
1
private final static Logger logger
Final.
Multiplicity:
1
Static.
the selector thread that manages the non-blocking DatagramChannel
Multiplicity:
1
private ReentrantLock writeLock
concurrency control for the packet write queue
Multiplicity:
1
private ConcurrentLinkedQueue writeQueue
packet write queue for controlling non-blocking write routines
Multiplicity:
1
creates a PacketChannel with the specified accessPoint parent, internal
DatagramChannel and SelectorThread
Parameters:
accessPoint the parent PacketChannelAccessPoint that manages the
channel (needed for closing)
datagramChannel the channel over which packets are sent and received
selectorThread the non-blocking io-controller thread
Stereotype:
create
public void close ()
closes the channel by removing itself from its associated access point
and setting its state as CLOSED
Return:
the listener associated with the PacketChannel
protected DatagramChannel getDatagramChannel ()
Return:
the DatagramChannel instance over which Packets are sent and received
not relevant for a non-connection oriented packet channel
Return:
null not relevant for a non-connection oriented packet channel
not relevant for a non-connection oriented packet channel
Return:
null not relevant for a non-connection oriented packet channel
public void onRead ()
call-back invoked by the selector thread when the underlying
DatagramChannel is ready for reading. The PacketChannel attempts to read
a packet and deliver it to its associated PacketChannelListener.
public void onWrite ()
call-back invoked by the selector thread when the underlying
DatagramChannel is ready for writing. The methods scans the packet write
queue and writes as many packets to the channel as possible
public void send (Packet packet)
Sends the specified packet to the address specified in the packet. NOTE
the packet will be written to the write queue until the selector indicates
that the underlying DatagramChannel is ready for writing
Parameters:
packet the packet to send
Throws:
IOException
assigns the specified PacketChannelListener to receive channel Packets
Parameters:
channelListener the PacketChannelListener to inform of new Packets
| | | | SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
|
|