|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jumpi.impl.connector.udp.UdpTransceiver
A connectionless UdpTransceiver establishes a DatagramSocket on a configured port and continuously reads packets from that port. Read packets are delivered to the UdpConnector via the callback onReceive().
A send is provided which sends from the DatagramSocket to any Udp address.
Constructor Summary | |
UdpTransceiver()
Creates a new UdpTransceiver. |
Method Summary | |
void |
configure(java.lang.String name,
Properties props)
Configure the UdpTransceiver. |
java.net.InetAddress |
getInetAddress()
Return the InetAddress. |
java.lang.String |
getName()
Get the fully qualified name of the instance. |
int |
getPort()
Return the port. |
java.lang.String |
getTaskId()
A unique name for the task in the VM. |
boolean |
isLongRunning()
Returns true since the Udp reading thread may block for at most readtimeout - which should be relatively long in terms of thread processing time. |
boolean |
isSchedulable()
The instance is schedulable as long as the component is not shutdown. |
void |
manage(Component root,
Component parent,
java.lang.String operation,
java.util.Hashtable parameters)
Perform a recursive management operation through the Jumpi component tree, using the parameters provided. |
void |
run()
The UdpTransceiver task continuously reads packets from the DatagramSocket and delivers to the UdpConnector's onReceive method. |
void |
send(java.net.DatagramPacket pack)
Send a DatagramPacket via the DatagramSocket. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UdpTransceiver()
Method Detail |
public void configure(java.lang.String name, Properties props) throws java.lang.Exception
The following configuration attributes are defined:
datagramsize - integer[0..MAX-INT] - optional[65536].
The receive buffer size in bytes which limits the size of incoming packets. Should correspond to the Udp packet size on the network.
port - integer[0..MAX-INT] - optional[8888].
The Udp port on which to establish a continuous listener and send packets from.
readtimeout - integer[1000..MAX-INT] - optional[30000].
The datagram socket read timeout in milliseconds. Maximum time interval that the reading thread will be stuck in the socket's read call if there is nothing to receive.
address - string - optional.
The local address to use if this is to be different from the localhost address. Used to determine the network card to use on multi-homed hosts.
configure
in interface Configurable
name
- the fully qualified instance name.props
- the read-only properties to configure the instance with.
java.lang.Exception
- when configuration is unsuccessful.
java.lang.IllegalArgumentException
- if name or properties are missing.public void manage(Component root, Component parent, java.lang.String operation, java.util.Hashtable parameters) throws java.lang.Exception
The following management actions are handled:
manage
in interface Manageable
root
- the Jumpi instance at the root of the component tree.parent
- the immediate parent of the component.operation
- the operation.parameters
- the operation parameters.
java.lang.Exception
- if any failure to perform management occurs.
java.lang.IllegalArgumentException
- when parameters are missing.public java.lang.String getName()
getName
in interface Configurable
configure(java.lang.String, org.jumpi.spi.Properties)
public java.lang.String getTaskId()
getTaskId
in interface Task
public boolean isSchedulable()
isSchedulable
in interface Task
public boolean isLongRunning()
isLongRunning
in interface Task
public void run()
run
in interface java.lang.Runnable
UdpConnector.onReceive(java.net.DatagramPacket)
public void send(java.net.DatagramPacket pack) throws java.lang.Exception
pack
- the DatagramPacket containing the data to send.
java.lang.Exception
- if any failure condition occurs during send.public int getPort()
public java.net.InetAddress getInetAddress()
|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |