org.objectweb.carol.cmi
Class ServerStubList

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

public class ServerStubList
extends java.lang.Object

A container of regular stubs to RMI-exported clustered objects. It is used by cluster stubs to choose to which clustered object redirect a request. Regular stubs have to be the same class.

Author:
Simon Nieuviarts

Method Summary
static void debug(java.lang.String mesg)
          Print a debug message on the console
static ClusterStub deserialize(byte[] serialized)
          Deserialize a byte array to create a cluster stub
 byte[] getSerialized()
           
 java.util.Set getSetOfStubs()
          Get the set of stubs (synchronized)
 boolean isStubDebug()
          Test is debug mode is enabled
static ClusterStub read(java.io.ObjectInput in)
          Read the input and builds a server stubs list
 void removeStub(ClusterId serverId)
          Remove a stub in the clustered stub (Synchronized)
 void removeStub(StubData sd)
          Remove a stub in the clustered stub (Synchronized)
 java.lang.String toContentsString()
          Convert the stubs list to a readable string
 java.lang.String toString()
           
 void write(java.io.ObjectOutput out)
          Write the server stubs list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSerialized

public byte[] getSerialized()
                     throws java.io.IOException
Returns:
the serialized of the server stubs list
Throws:
java.io.IOException - if an exception occurs

write

public void write(java.io.ObjectOutput out)
           throws java.io.IOException
Write the server stubs list

Parameters:
out - output
Throws:
java.io.IOException - if an I/O error occurs

read

public static ClusterStub read(java.io.ObjectInput in)
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException
Read the input and builds a server stubs list

Parameters:
in - input
Throws:
java.io.IOException - if an I/O error occurs
java.lang.ClassNotFoundException - if the expected class can not be created

deserialize

public static ClusterStub deserialize(byte[] serialized)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Deserialize a byte array to create a cluster stub

Parameters:
serialized - but to deserialize
Returns:
Stub to clustered object
Throws:
java.io.IOException - if an I/O error occurs
java.lang.ClassNotFoundException - if the expected class can not be instanciated

removeStub

public void removeStub(ClusterId serverId)
Remove a stub in the clustered stub (Synchronized)

Parameters:
serverId - stub identifier to remove

removeStub

public void removeStub(StubData sd)
Remove a stub in the clustered stub (Synchronized)

Parameters:
sd - stub data

getSetOfStubs

public java.util.Set getSetOfStubs()
Get the set of stubs (synchronized)

Returns:
collection of stubs

isStubDebug

public boolean isStubDebug()
Test is debug mode is enabled

Returns:
true if enabled, false otherwise

debug

public static void debug(java.lang.String mesg)
Print a debug message on the console

Parameters:
mesg - message

toContentsString

public java.lang.String toContentsString()
Convert the stubs list to a readable string

Returns:
String form of the stubs list

toString

public java.lang.String toString()
Returns:
String form of the stubs list