|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.UCL.xmiddle.framework.controller.Acknowledger | +--edu.UCL.xmiddle.controller.UDPAcknowledger
UDPAcknowledger sends a specific DatagramPacket
through a given DatagramSocket
, waiting for that
packet to be acknowledged. Upon initialisation, the
UDPAcknowledger
must know which packet to send, where
to send it from and which is the Acknowledgement string that it
must receive to decide that the packet has been acknowledged. It
will then send the packet for a specified maximum number of times,
waiting in between each time for a specified number of miliseconds,
up until the packet is acknowledged, or the maximum number of
times/tries has been exceeded. Note that the
UDPAcknowledger
does not receive data through the
DatagramSocket
. In order to verify that the packet has
been acknowledged, it expects the module that did receive the
acknowledgement (in this case, probably UDPNetwork
to
forward the acknowledgement, using match
Acknowledger
Field Summary |
Fields inherited from class edu.UCL.xmiddle.framework.controller.Acknowledger |
maxtimes, timeout |
Constructor Summary | |
UDPAcknowledger(long timeout,
int maxtries,
java.net.DatagramSocket connection,
java.lang.String data,
java.net.DatagramPacket packet)
Creates a new UDPAcknowledger instance. |
Method Summary | |
void |
abort()
Aborts the execution of the acknowledger. |
boolean |
match(java.lang.Object id)
This method is called by the module that actually receives an acknowledgement |
boolean |
verify()
Sends the packet to the remote host. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UDPAcknowledger(long timeout, int maxtries, java.net.DatagramSocket connection, java.lang.String data, java.net.DatagramPacket packet)
UDPAcknowledger
instance.
timeout
- The time to wait before re-tryingmaxtries
- The maximum number of times the message is
going to be sentconnection
- The connection though which the message is
going rto be sentdata
- The data that must be received to realise that the
packet has been received by the target hostpacket
- the DatagramPacket
to be sentMethod Detail |
public boolean verify()
verify
in class Acknowledger
abort()
was valled or the maximum number of
retries has been exceeded and no acknowledgement has come inpublic boolean match(java.lang.Object id)
match
in class Acknowledger
id
- The acknowledgement received
public void abort()
abort
in class Acknowledger
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |