planet.symphony.behaviours
Class CloseLongConnectBehaviour

java.lang.Object
  extended by planet.symphony.behaviours.CloseLongConnectBehaviour
All Implemented Interfaces:
Behaviour

public class CloseLongConnectBehaviour
extends java.lang.Object
implements Behaviour

CloseLongConnectBehaviour attemps to handle a CLOSE_LONG_CONNECT request. Two cases are possible: ~ Node is stable: it has lost a long link and must send a new QUERY_CONNECT message in order to get K links. ~ Node is not stable: it is already trying to get K long links, so not a new QUERY_CONNECT message is necessary.

Author:
Marc Sanchez , Helio Tejedor

Constructor Summary
CloseLongConnectBehaviour()
           
 
Method Summary
 java.lang.String getName()
           
 RouteMessage[] onMessage(RouteMessage msg, Node node)
          Given a RouteMessage and a Node as input, onMessage's method do execution steps for the behaviour.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CloseLongConnectBehaviour

public CloseLongConnectBehaviour()
Method Detail

onMessage

public RouteMessage[] onMessage(RouteMessage msg,
                                Node node)
Given a RouteMessage and a Node as input, onMessage's method do execution steps for the behaviour. Node should be casted to Node's class in order to manage data structures and protocol of designed overlay.

Specified by:
onMessage in interface Behaviour
Parameters:
msg - RouteMessage taken as input.
node - Node taken as input.
Returns:
Returns either an array of RouteMessages or null when no messages need to transmit this node.

getName

public java.lang.String getName()
Specified by:
getName in interface Behaviour
Returns:
Returns the name of behaviour.

toString

public java.lang.String toString()
Specified by:
toString in interface Behaviour
Overrides:
toString in class java.lang.Object
Returns:
Returns a string representation of the behaviour. In general, the toString method returns a string that "textually represents" this behaviour. The result should be a concise but informative representation that is easy for a person to read.