org.apache.axis2.clustering.tribes
Class TribesClusteringAgent

java.lang.Object
  extended by org.apache.axis2.clustering.tribes.TribesClusteringAgent
All Implemented Interfaces:
ClusteringAgent, ParameterInclude

public class TribesClusteringAgent
extends Object
implements ClusteringAgent

The main ClusteringAgent class for the Tribes based clustering implementation


Constructor Summary
TribesClusteringAgent()
           
 
Method Summary
 void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)
          Set the load balance event handler which will be notified when load balance events occur.
 void addParameter(Parameter param)
          Method addParameter.
 void deserializeParameters(org.apache.axiom.om.OMElement parameterElement)
           
 void finalize()
          Do cleanup & leave the cluster
 Set<String> getDomains()
          Get all the domains that this ClusteringAgent belongs to
 GroupManagementAgent getGroupManagementAgent(String applicationDomain)
          Get the LoadBalanceEventHandler which corresponds to the applicationDomain This will be valid only when this node is running in loadBalance mode
 List<Member> getMembers()
          Get the list of members in a static group
 NodeManager getNodeManager()
           
 Parameter getParameter(String name)
          Method getParameter.
 ArrayList getParameters()
          Gets all the parameters in a given description.
 StateManager getStateManager()
           
 void init()
          Initialize the cluster.
 boolean isParameterLocked(String parameterName)
          Checks whether the parameter is locked at any level.
 void removeParameter(Parameter param)
           
 List<ClusteringCommand> sendMessage(ClusteringMessage message, boolean isRpcMessage)
          Send a message to all members in this member's primary cluster
 void setConfigurationContext(ConfigurationContext configurationContext)
          Set the system's configuration context.
 void setMembers(List<Member> members)
          Set the static members of the cluster.
 void setNodeManager(NodeManager nodeManager)
          Set the NodeManager corresponding to this ClusteringAgent.
 void setStateManager(StateManager stateManager)
          Set the StateManager corresponding to this ClusteringAgent.
 void shutdown()
          Shutdown the cluster.
 boolean synchronizeAllMembers()
          Method to check whether all members in the cluster have to be kept in sync at all times.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TribesClusteringAgent

public TribesClusteringAgent()
Method Detail

setMembers

public void setMembers(List<Member> members)
Description copied from interface: ClusteringAgent
Set the static members of the cluster. This is used only with static group membership

Specified by:
setMembers in interface ClusteringAgent
Parameters:
members - Members to be added

getMembers

public List<Member> getMembers()
Description copied from interface: ClusteringAgent
Get the list of members in a static group

Specified by:
getMembers in interface ClusteringAgent
Returns:
The members if static group membership is used. If any other membership scheme is used, the values returned may not be valid

addGroupManagementAgent

public void addGroupManagementAgent(GroupManagementAgent agent,
                                    String applicationDomain)
Description copied from interface: ClusteringAgent
Set the load balance event handler which will be notified when load balance events occur. This will be valid only when this node is running in loadBalance mode

Specified by:
addGroupManagementAgent in interface ClusteringAgent
Parameters:
agent - The load balance event handler
applicationDomain - The application domain which is handled by the eventHandler

getGroupManagementAgent

public GroupManagementAgent getGroupManagementAgent(String applicationDomain)
Description copied from interface: ClusteringAgent
Get the LoadBalanceEventHandler which corresponds to the applicationDomain This will be valid only when this node is running in loadBalance mode

Specified by:
getGroupManagementAgent in interface ClusteringAgent
Parameters:
applicationDomain - The application domain to which the application nodes being load balanced belong to
Returns:
LoadBalanceEventHandler which corresponds to the applicationDomain

getDomains

public Set<String> getDomains()
Description copied from interface: ClusteringAgent
Get all the domains that this ClusteringAgent belongs to

Specified by:
getDomains in interface ClusteringAgent
Returns:
the domains of this ClusteringAgent

getStateManager

public StateManager getStateManager()
Specified by:
getStateManager in interface ClusteringAgent
Returns:
The StateManager

getNodeManager

public NodeManager getNodeManager()
Specified by:
getNodeManager in interface ClusteringAgent
Returns:
The NodeManager

init

public void init()
          throws ClusteringFault
Initialize the cluster.

Specified by:
init in interface ClusteringAgent
Throws:
ClusteringFault - If initialization fails

finalize

public void finalize()
Description copied from interface: ClusteringAgent
Do cleanup & leave the cluster

Specified by:
finalize in interface ClusteringAgent
Overrides:
finalize in class Object

sendMessage

public List<ClusteringCommand> sendMessage(ClusteringMessage message,
                                           boolean isRpcMessage)
                                    throws ClusteringFault
Description copied from interface: ClusteringAgent
Send a message to all members in this member's primary cluster

Specified by:
sendMessage in interface ClusteringAgent
Parameters:
message - The message to be sent
isRpcMessage - Indicates whether the message has to be sent in RPC mode
Returns:
A list of responses if the message is sent in RPC mode
Throws:
ClusteringFault - If an error occurs while sending the message

setNodeManager

public void setNodeManager(NodeManager nodeManager)
Description copied from interface: ClusteringAgent
Set the NodeManager corresponding to this ClusteringAgent. This is an optional attribute. We can have a cluster with no configuration management, in which case the configurationManager will be null. This value is set by the ClusterBuilder, by reading the "configurationManager" element in the axis2.xml

e.g.

Specified by:
setNodeManager in interface ClusteringAgent
Parameters:
nodeManager - The NodeManager instance

setStateManager

public void setStateManager(StateManager stateManager)
Description copied from interface: ClusteringAgent
Set the StateManager corresponding to this ClusteringAgent. This is an optional attribute. We can have a cluster with no context replication, in which case the contextManager will be null. This value is set by the ClusterBuilder, by reading the "contextManager" element in the axis2.xml

e.g.

Specified by:
setStateManager in interface ClusteringAgent
Parameters:
stateManager - The StateManager instance

addParameter

public void addParameter(Parameter param)
                  throws AxisFault
Description copied from interface: ParameterInclude
Method addParameter.

Specified by:
addParameter in interface ParameterInclude
Throws:
AxisFault

deserializeParameters

public void deserializeParameters(org.apache.axiom.om.OMElement parameterElement)
                           throws AxisFault
Specified by:
deserializeParameters in interface ParameterInclude
Throws:
AxisFault

getParameter

public Parameter getParameter(String name)
Description copied from interface: ParameterInclude
Method getParameter.

Specified by:
getParameter in interface ParameterInclude
Returns:
Returns Parameter.

getParameters

public ArrayList getParameters()
Description copied from interface: ParameterInclude
Gets all the parameters in a given description.

Specified by:
getParameters in interface ParameterInclude
Returns:
Returns ArrayList.

isParameterLocked

public boolean isParameterLocked(String parameterName)
Description copied from interface: ParameterInclude
Checks whether the parameter is locked at any level.

Specified by:
isParameterLocked in interface ParameterInclude

removeParameter

public void removeParameter(Parameter param)
                     throws AxisFault
Specified by:
removeParameter in interface ParameterInclude
Throws:
AxisFault

shutdown

public void shutdown()
              throws ClusteringFault
Shutdown the cluster. This member will leave the cluster when this method is called.

Specified by:
shutdown in interface ClusteringAgent
Throws:
ClusteringFault - If an error occurs while shutting down

setConfigurationContext

public void setConfigurationContext(ConfigurationContext configurationContext)
Description copied from interface: ClusteringAgent
Set the system's configuration context. This will be used by the clustering implementations to get information about the Axis2 environment and to correspond with the Axis2 environment

Specified by:
setConfigurationContext in interface ClusteringAgent
Parameters:
configurationContext - The configuration context

synchronizeAllMembers

public boolean synchronizeAllMembers()
Method to check whether all members in the cluster have to be kept in sync at all times. Typically, this will require each member in the cluster to ACKnowledge receipt of a particular message, which may have a significant performance hit.

Returns:
true - if all members in the cluster should be kept in sync at all times, false otherwise


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.