peersim.core
Interface Fallible

All Known Subinterfaces:
Node
All Known Implementing Classes:
GeneralNode, ModifiableNode

public interface Fallible

Instances of classes implementing this interface maintain a fail state, i.e. information about the availability of the object.


Field Summary
static int DEAD
          Fail state indicating that the object is dead and recovery is not possible.
static int DOWN
          Fail state indicating that the object is not dead, but is temporarily not accessible.
static int OK
          Fail state which indicates that the object is operating normally.
 
Method Summary
 int getFailState()
          Returns the state of this object.
 boolean isUp()
          Convenience method to check if the node is up and running
 void setFailState(int failState)
          Sets the fails state of this object.
 

Field Detail

OK

static final int OK
Fail state which indicates that the object is operating normally.

See Also:
Constant Field Values

DEAD

static final int DEAD
Fail state indicating that the object is dead and recovery is not possible. When this state is set, it is a good idea to make sure that the state of the object becomes such that any attempt to operate on it causes a visible error of some kind.

See Also:
Constant Field Values

DOWN

static final int DOWN
Fail state indicating that the object is not dead, but is temporarily not accessible.

See Also:
Constant Field Values
Method Detail

getFailState

int getFailState()
Returns the state of this object. Must be one of the constants defined in interface Fallible.


setFailState

void setFailState(int failState)
Sets the fails state of this object. Parameter must be one of the constants defined in interface Fallible.


isUp

boolean isUp()
Convenience method to check if the node is up and running

Returns:
must return true if and only if getFailState()==OK