Class TribesClusteringAgent
- java.lang.Object
-
- 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
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SUB_DOMAIN
-
Constructor Summary
Constructors Constructor Description TribesClusteringAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)
Set the load balance event handler which will be notified when load balance events occur.void
addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain, String applicationSubDomain)
Add a GroupManagementAgent to an application domain + sub-domainvoid
addParameter(Parameter param)
Method addParameter.void
deserializeParameters(OMElement parameterElement)
void
finalize()
Do cleanup & leave the clusterint
getAliveMemberCount()
Get the number of members alive.Set<String>
getDomains()
Get all the domains that this ClusteringAgent belongs toGroupManagementAgent
getGroupManagementAgent(String applicationDomain)
Get the GroupManagementAgent which corresponds to theapplicationDomain
This will be valid only when this node is running in groupManagementGroupManagementAgent
getGroupManagementAgent(String applicationDomain, String applicationSubDomain)
Get the GroupManagementAgent which corresponds to theapplicationDomain + sub-domain
List<Member>
getMembers()
Get the list of members in a static groupNodeManager
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
isCoordinator()
Checks whether this member is the coordinator for the clusterboolean
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 clustervoid
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.
-
-
-
Field Detail
-
DEFAULT_SUB_DOMAIN
public static final String DEFAULT_SUB_DOMAIN
- See Also:
- Constant Field Values
-
-
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 interfaceClusteringAgent
- 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 interfaceClusteringAgent
- Returns:
- The members if static group membership is used. If any other membership scheme is used, the values returned may not be valid
-
getAliveMemberCount
public int getAliveMemberCount()
Description copied from interface:ClusteringAgent
Get the number of members alive.- Specified by:
getAliveMemberCount
in interfaceClusteringAgent
- Returns:
- the number of members alive.
-
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 interfaceClusteringAgent
- Parameters:
agent
- The GroupManagementAgent to be addedapplicationDomain
- The application domain which is handled by the GroupManagementAgent
-
addGroupManagementAgent
public void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain, String applicationSubDomain)
Description copied from interface:ClusteringAgent
Add a GroupManagementAgent to an application domain + sub-domain- Specified by:
addGroupManagementAgent
in interfaceClusteringAgent
- Parameters:
agent
- The GroupManagementAgent to be addedapplicationDomain
- The application domain which is handled by the GroupManagementAgentapplicationSubDomain
- The application sub-domain which is handled by the GroupManagementAgent
-
getGroupManagementAgent
public GroupManagementAgent getGroupManagementAgent(String applicationDomain)
Description copied from interface:ClusteringAgent
Get the GroupManagementAgent which corresponds to theapplicationDomain
This will be valid only when this node is running in groupManagement- Specified by:
getGroupManagementAgent
in interfaceClusteringAgent
- Parameters:
applicationDomain
- The application domain to which the application nodes being load balanced belong to- Returns:
- GroupManagementAgent which corresponds to the
applicationDomain
-
getGroupManagementAgent
public GroupManagementAgent getGroupManagementAgent(String applicationDomain, String applicationSubDomain)
Description copied from interface:ClusteringAgent
Get the GroupManagementAgent which corresponds to theapplicationDomain + sub-domain
- Specified by:
getGroupManagementAgent
in interfaceClusteringAgent
- Parameters:
applicationDomain
- The application domain which is handled by the GroupManagementAgentapplicationSubDomain
- The application sub-domain which is handled by the GroupManagementAgent- Returns:
- GroupManagementAgent which corresponds to the
applicationDomain + sub-domain
-
getDomains
public Set<String> getDomains()
Description copied from interface:ClusteringAgent
Get all the domains that this ClusteringAgent belongs to- Specified by:
getDomains
in interfaceClusteringAgent
- Returns:
- the domains of this ClusteringAgent
-
getStateManager
public StateManager getStateManager()
- Specified by:
getStateManager
in interfaceClusteringAgent
- Returns:
- The StateManager
-
getNodeManager
public NodeManager getNodeManager()
- Specified by:
getNodeManager
in interfaceClusteringAgent
- Returns:
- The NodeManager
-
isCoordinator
public boolean isCoordinator()
Description copied from interface:ClusteringAgent
Checks whether this member is the coordinator for the cluster- Specified by:
isCoordinator
in interfaceClusteringAgent
- Returns:
- true if this member is the coordinator, and false otherwise
-
init
public void init() throws ClusteringFault
Initialize the cluster.- Specified by:
init
in interfaceClusteringAgent
- Throws:
ClusteringFault
- If initialization fails
-
finalize
public void finalize()
Description copied from interface:ClusteringAgent
Do cleanup & leave the cluster- Specified by:
finalize
in interfaceClusteringAgent
- Overrides:
finalize
in classObject
-
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 interfaceClusteringAgent
- Parameters:
message
- The message to be sentisRpcMessage
- 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 theClusterBuilder
, by reading the "configurationManager" element in the axis2.xml e.g.- Specified by:
setNodeManager
in interfaceClusteringAgent
- 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 theClusterBuilder
, by reading the "contextManager" element in the axis2.xml e.g.- Specified by:
setStateManager
in interfaceClusteringAgent
- Parameters:
stateManager
- The StateManager instance
-
addParameter
public void addParameter(Parameter param) throws AxisFault
Description copied from interface:ParameterInclude
Method addParameter.- Specified by:
addParameter
in interfaceParameterInclude
- Throws:
AxisFault
-
deserializeParameters
public void deserializeParameters(OMElement parameterElement) throws AxisFault
- Specified by:
deserializeParameters
in interfaceParameterInclude
- Throws:
AxisFault
-
getParameter
public Parameter getParameter(String name)
Description copied from interface:ParameterInclude
Method getParameter.- Specified by:
getParameter
in interfaceParameterInclude
- Returns:
- Returns Parameter.
-
getParameters
public ArrayList getParameters()
Description copied from interface:ParameterInclude
Gets all the parameters in a given description.- Specified by:
getParameters
in interfaceParameterInclude
- 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 interfaceParameterInclude
-
removeParameter
public void removeParameter(Parameter param) throws AxisFault
- Specified by:
removeParameter
in interfaceParameterInclude
- 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 interfaceClusteringAgent
- 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 interfaceClusteringAgent
- 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
-
-