edu.UCL.xmiddle.framework.controller
Class Acknowledger

java.lang.Object
  |
  +--edu.UCL.xmiddle.framework.controller.Acknowledger
Direct Known Subclasses:
UDPAcknowledger

public abstract class Acknowledger
extends java.lang.Object

Acknowledger.java Acknowledger is a mechanism used by the networking module of xmiddle to make sure that information has been sent/received to/by another host. Using a specified timeout (which must have passed without receiving an acknowledgement) an Acknowledger will re-send the data to the remote host for a specified number of maximum times. Created: Fri Jul 20 13:04:50 2001


Field Summary
protected  long maxtimes
          The maximum number of times that the data will be sent if no acknowledgement is received.
protected  long timeout
          The timeout (in milliseconds) before re-sending the data.
 
Constructor Summary
Acknowledger(long timeout, int maxtries)
          Initialises the acknowledger
 
Method Summary
abstract  void abort()
          Aborts the execution of the Acknowledger.
abstract  boolean match(java.lang.Object data)
          If the given data matches the data that is expected by the acknowledger, then verify returns true.
abstract  boolean verify()
          Starts sending the data to the remote host.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeout

protected long timeout
The timeout (in milliseconds) before re-sending the data.


maxtimes

protected long maxtimes
The maximum number of times that the data will be sent if no acknowledgement is received.

Constructor Detail

Acknowledger

public Acknowledger(long timeout,
                    int maxtries)
Initialises the acknowledger

Parameters:
timeout - time to wait before retrying
Method Detail

verify

public abstract boolean verify()
Starts sending the data to the remote host. It returns true if the acknowledgement has been received, or false if it has been aborted or the data has been sent for the specified number of maximum times but no acknowledgement has been sent.

Returns:
a boolean value

match

public abstract boolean match(java.lang.Object data)
If the given data matches the data that is expected by the acknowledger, then verify returns true. This method is called when data is received by the Networking module which are destined to an acknowledger.

Parameters:
data - the data received which could be what the Acknowledger expects.
Returns:
true if data match the ones expected or false otherwise

abort

public abstract void abort()
Aborts the execution of the Acknowledger. This is called in case of network disconnection, etc.