org.objectweb.carol.cmi
Class ClusterStubData

java.lang.Object
  extended byorg.objectweb.carol.cmi.ClusterStubData

public class ClusterStubData
extends java.lang.Object

Stubs to clustered objects use this class. They may contain several stubs to regular objects.

Author:
Simon Nieuviarts

Constructor Summary
ClusterStubData(ClusterId serverId, byte[] stubSer, int factor)
          Construct a new cluster stub data, containing a regular stub.
 
Method Summary
 void debug(java.lang.String mesg)
           
 ClusterConfig getClusterConfig()
          You can assume it returns a non null structure if it is not a stub to a cluster registry.
 ClusterStub getClusterStub()
           
 StubData getLocal()
           
 StubLB getRandom()
           
 StubLB getRoundRobin()
           
 boolean isStubDebug()
           
static ClusterStubData read(java.io.ObjectInput in, ClusterStub cs)
          Deserialize a ClusterStubData.
 boolean removeStub(ClusterId serverId)
          This function fails if and only if the stub to remove is the last one.
 boolean removeStubData(StubData sd)
          This function fails if and only if the stub to remove is the last one.
 void setClusterConfig(ClusterConfig cfg)
           
 boolean setStub(ClusterId serverId, byte[] stubSer, int factor)
          Add a regular stub in this cluster stub.
 boolean setStub(ClusterRegistryInternal stub)
          Add a regular stub in this cluster stub.
 java.lang.String toContentsString()
           
 java.lang.String toString()
           
 void write(java.io.ObjectOutput out)
          Serialize this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClusterStubData

public ClusterStubData(ClusterId serverId,
                       byte[] stubSer,
                       int factor)
                throws java.rmi.RemoteException
Construct a new cluster stub data, containing a regular stub.

Parameters:
serverId - the cluster id of the server where the remote object is running.
stubSer - the regular stub, serialized.
factor - factor for round robin load lalancing.
Method Detail

getClusterStub

public ClusterStub getClusterStub()
                           throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

setStub

public boolean setStub(ClusterId serverId,
                       byte[] stubSer,
                       int factor)
Add a regular stub in this cluster stub.

Parameters:
serverId - the cluster id of the server where the remote object is running.
Returns:
false if the class of the stub is not the same the other objects in the stub, or if factor is < 1.

setStub

public boolean setStub(ClusterRegistryInternal stub)
Add a regular stub in this cluster stub. Can be used only for the cluster registry.

Parameters:
stub - a stub to a registry.
Returns:
false if the class of the stub is not the same the other objects in the stub.

write

public void write(java.io.ObjectOutput out)
           throws java.io.IOException
Serialize this object. Used by the encapsulating ClusterStub.

Parameters:
out - the output stream
Throws:
java.io.IOException

read

public static ClusterStubData read(java.io.ObjectInput in,
                                   ClusterStub cs)
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException
Deserialize a ClusterStubData.

Parameters:
in - input stream
Returns:
the object
Throws:
java.io.IOException
java.lang.ClassNotFoundException

removeStub

public boolean removeStub(ClusterId serverId)
This function fails if and only if the stub to remove is the last one.


removeStubData

public boolean removeStubData(StubData sd)
This function fails if and only if the stub to remove is the last one.


setClusterConfig

public void setClusterConfig(ClusterConfig cfg)

getClusterConfig

public ClusterConfig getClusterConfig()
You can assume it returns a non null structure if it is not a stub to a cluster registry. cfg should have been initialized by the constructor


getRoundRobin

public StubLB getRoundRobin()

getRandom

public StubLB getRandom()

getLocal

public StubData getLocal()
                  throws NoLocalStubException
Throws:
NoLocalStubException

isStubDebug

public boolean isStubDebug()

debug

public void debug(java.lang.String mesg)

toContentsString

public java.lang.String toContentsString()

toString

public java.lang.String toString()