org.objectweb.carol.cmi

Class 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(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(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.
String
toContentsString()
String
toString()
void
write(ObjectOutput out)
Serialize this object.

Constructor Details

ClusterStubData

public ClusterStubData(ClusterId serverId,
                       byte[] stubSer,
                       int factor)
            throws 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 Details

debug

public void debug(String mesg)


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


getClusterStub

public ClusterStub getClusterStub()
            throws RemoteException


getLocal

public StubData getLocal()
            throws NoLocalStubException


getRandom

public StubLB getRandom()


getRoundRobin

public StubLB getRoundRobin()


isStubDebug

public boolean isStubDebug()


read

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

Parameters:
in - input stream

Returns:
the object


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)


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 <321.


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.


toContentsString

public String toContentsString()


toString

public String toString()


write

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

Parameters:
out - the output stream