jgroup.relacs.simulator
Class SocketStatusImpl

java.lang.Object
  extended by jgroup.relacs.simulator.SocketStatusImpl
All Implemented Interfaces:
java.rmi.Remote, SocketStatus

public class SocketStatusImpl
extends java.lang.Object
implements SocketStatus

Implementation of the SocketStatus interface, allowing an external entity (the simulator) to set the status of particular links from the JVM hosting this instance of the SocketStatusImpl. Note that objects within the local JVM may obtain a reference to a "singlton" instance of this class, and thus query the link connectivity map through the isReliable() method.

Since:
Jgroup 0.5
Author:
Alberto Montresor, Hein Meling

Field Summary
 
Fields inherited from interface jgroup.relacs.simulator.SocketStatus
BASE, SOCKET_STATUS
 
Method Summary
 void commit()
          This method must be invoked before the current reachability pattern will be activated.
 java.util.Map<java.net.InetAddress,java.lang.Integer> getStatus()
          Returns the content of the current socket status object.
static SocketStatusImpl instance()
          Obtain the local instance of the socket status object.
 boolean isReliable(java.net.InetAddress address)
          Check if the link to the given internet address is considered reliable.
 boolean isReliable(java.lang.String hostname)
          Check if the link to the given internet host is considered reliable.
 void notifyStatus(java.util.Map<java.net.InetAddress,java.lang.Integer> committedLinks)
          Notifies any registered socket status implementations of the most recently commited reachability pattern of the local socket status instance.
 void register(SocketStatus sStatus)
          Register the given socket status object with this socket status implementation, so as to notify the other socket status instances of changes to the reachability pattern.
 void setStatus(java.net.InetAddress inet, int prob)
          Set the probability of a datagram packet to be correctly delivered at the host identified by inet.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

instance

public static SocketStatusImpl instance()
Obtain the local instance of the socket status object.


isReliable

public boolean isReliable(java.net.InetAddress address)
Check if the link to the given internet address is considered reliable.


isReliable

public boolean isReliable(java.lang.String hostname)
                   throws java.net.UnknownHostException
Check if the link to the given internet host is considered reliable.

Throws:
java.net.UnknownHostException

register

public void register(SocketStatus sStatus)
              throws java.rmi.RemoteException
Description copied from interface: SocketStatus
Register the given socket status object with this socket status implementation, so as to notify the other socket status instances of changes to the reachability pattern.

Specified by:
register in interface SocketStatus
Throws:
java.rmi.RemoteException

commit

public void commit()
            throws java.rmi.RemoteException
Description copied from interface: SocketStatus
This method must be invoked before the current reachability pattern will be activated. That is, after invoking a series of setStatus methods, an invocation of this method will activate the newly set reachability pattern.

Specified by:
commit in interface SocketStatus
Throws:
java.rmi.RemoteException

notifyStatus

public void notifyStatus(java.util.Map<java.net.InetAddress,java.lang.Integer> committedLinks)
                  throws java.rmi.RemoteException
Description copied from interface: SocketStatus
Notifies any registered socket status implementations of the most recently commited reachability pattern of the local socket status instance. This can be used by socket status instances running in a JVM separate from the BootstrapRegistry.

Specified by:
notifyStatus in interface SocketStatus
Throws:
java.rmi.RemoteException

getStatus

public java.util.Map<java.net.InetAddress,java.lang.Integer> getStatus()
                                                                throws java.rmi.RemoteException
Description copied from interface: SocketStatus
Returns the content of the current socket status object. This is used to obtain the state of a socket status object running in another JVM on the local machine.

Specified by:
getStatus in interface SocketStatus
Throws:
java.rmi.RemoteException

setStatus

public void setStatus(java.net.InetAddress inet,
                      int prob)
               throws java.rmi.RemoteException
Description copied from interface: SocketStatus
Set the probability of a datagram packet to be correctly delivered at the host identified by inet. The probability is defined as prob / BASE.

Specified by:
setStatus in interface SocketStatus
Throws:
java.rmi.RemoteException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.