jgroup.core
Class GroupManager

java.lang.Object
  extended by jgroup.core.GroupManager

public final class GroupManager
extends java.lang.Object

The GroupManager class is used to configure the Jgroup system. In order to make use of the Jgroup facilities, a group manager must be obtained through the invocation of static factory method getGroupManager. The main parameter to this method is the server object that implements a number of listener interfaces. That is, the server object is a listener for various services. A group manager is constructed by collecting and configuring the services needed by the server object. In order for a server object to gain access to one of the provided services, the method getService can be invoked on the group manager, by specifying the service interface class or the shorthand service name (as given in the services.xml file) of the desired service.

Since:
Jgroup 0.8 (revised Jgroup 1.2)
Author:
Hein Meling, Alberto Montresor

Method Summary
static boolean contains(int gid)
           
 int getGroupId()
          Returns the group identifier for this group manager instance.
static GroupManager getGroupManager(int gid)
           
static GroupManager getGroupManager(int groupId, java.lang.String[] serviceSet, java.lang.Object listener)
          Returns a group manager object through which handlers, for each of the services associated with the listener interfaces implemented by the specified object, can be accessed.
static GroupManager getGroupManager(java.lang.Object listener)
          Returns a group manager object through which handlers, for each of the services associated with the listener interfaces implemented by the specified object, can be accessed.
 MemberId getLocalMember()
          Returns the local member identifier associated with this group manager.
 java.lang.Object getService(java.lang.Class cl)
          Returns an handler for a Jgroup service (e.g., the membership service) specified by the interface class cl.
static java.lang.Object getService(int gid, java.lang.Class service)
           
 java.lang.Object getService(java.lang.String serviceName)
          Returns an handler for a Jgroup service (e.g., the membership service) specified by the shorthand service name, as specified in the services.xml file.
static boolean isEmpty()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getService

public java.lang.Object getService(java.lang.Class cl)
Returns an handler for a Jgroup service (e.g., the membership service) specified by the interface class cl. Services provided by this instance of the group manager, must have been initialized when invoking the static factory method getGroupManager. That is, the service must have been specified either in the LayerStack entry of the corresponding application in the application.xml file, or through the serviceSet array provided to the getGroupManager method.

Parameters:
cl - Class specifying the interface of the required service.
Throws:
java.lang.ClassCastException - If the generated group manager is unable to provide the requested service class.

getService

public java.lang.Object getService(java.lang.String serviceName)
Returns an handler for a Jgroup service (e.g., the membership service) specified by the shorthand service name, as specified in the services.xml file. Services provided by this instance of the group manager, must have been initialized when invoking the static factory method getGroupManager. That is, the service must have been specified either in the LayerStack entry of the corresponding application in the application.xml file, or through the serviceSet array provided to the getGroupManager method.

Parameters:
serviceName - Shorthand name for the required service.
Throws:
java.lang.ClassCastException - If the generated group manager is unable to provide the requested service class.

getGroupId

public int getGroupId()
Returns the group identifier for this group manager instance.


getLocalMember

public MemberId getLocalMember()
Returns the local member identifier associated with this group manager.


getGroupManager

public static GroupManager getGroupManager(int gid)

getService

public static java.lang.Object getService(int gid,
                                          java.lang.Class service)

contains

public static boolean contains(int gid)

isEmpty

public static boolean isEmpty()

getGroupManager

public static GroupManager getGroupManager(java.lang.Object listener)
                                    throws JgroupException
Returns a group manager object through which handlers, for each of the services associated with the listener interfaces implemented by the specified object, can be accessed.

Parameters:
listener - Object implementing the listeners interfaces associated with the the requested services.
Throws:
JgroupException - Raised if some configuration error occurs.

getGroupManager

public static GroupManager getGroupManager(int groupId,
                                           java.lang.String[] serviceSet,
                                           java.lang.Object listener)
                                    throws JgroupException
Returns a group manager object through which handlers, for each of the services associated with the listener interfaces implemented by the specified object, can be accessed.

Parameters:
serviceSet - An array of Strings, each representing a service or layer that should be incorporated with the returned GroupManager.
listener - Object implementing the listeners interfaces associated with the the requested services.
Throws:
JgroupException - Raised if some configuration error occurs.


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