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 StringDEFAULT_SUB_DOMAIN
-
Constructor Summary
Constructors Constructor Description TribesClusteringAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)Set the load balance event handler which will be notified when load balance events occur.voidaddGroupManagementAgent(GroupManagementAgent agent, String applicationDomain, String applicationSubDomain)Add a GroupManagementAgent to an application domain + sub-domainvoidaddParameter(Parameter param)Method addParameter.voiddeserializeParameters(OMElement parameterElement)voidfinalize()Do cleanup & leave the clusterintgetAliveMemberCount()Get the number of members alive.Set<String>getDomains()Get all the domains that this ClusteringAgent belongs toGroupManagementAgentgetGroupManagementAgent(String applicationDomain)Get the GroupManagementAgent which corresponds to theapplicationDomainThis will be valid only when this node is running in groupManagementGroupManagementAgentgetGroupManagementAgent(String applicationDomain, String applicationSubDomain)Get the GroupManagementAgent which corresponds to theapplicationDomain + sub-domainList<Member>getMembers()Get the list of members in a static groupNodeManagergetNodeManager()ParametergetParameter(String name)Method getParameter.ArrayListgetParameters()Gets all the parameters in a given description.StateManagergetStateManager()voidinit()Initialize the cluster.booleanisCoordinator()Checks whether this member is the coordinator for the clusterbooleanisParameterLocked(String parameterName)Checks whether the parameter is locked at any level.voidremoveParameter(Parameter param)List<ClusteringCommand>sendMessage(ClusteringMessage message, boolean isRpcMessage)Send a message to all members in this member's primary clustervoidsetConfigurationContext(ConfigurationContext configurationContext)Set the system's configuration context.voidsetMembers(List<Member> members)Set the static members of the cluster.voidsetNodeManager(NodeManager nodeManager)Set the NodeManager corresponding to this ClusteringAgent.voidsetStateManager(StateManager stateManager)Set the StateManager corresponding to this ClusteringAgent.voidshutdown()Shutdown the cluster.booleansynchronizeAllMembers()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:ClusteringAgentSet the static members of the cluster. This is used only with static group membership- Specified by:
setMembersin interfaceClusteringAgent- Parameters:
members- Members to be added
-
getMembers
public List<Member> getMembers()
Description copied from interface:ClusteringAgentGet the list of members in a static group- Specified by:
getMembersin 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:ClusteringAgentGet the number of members alive.- Specified by:
getAliveMemberCountin interfaceClusteringAgent- Returns:
- the number of members alive.
-
addGroupManagementAgent
public void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)
Description copied from interface:ClusteringAgentSet 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:
addGroupManagementAgentin 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:ClusteringAgentAdd a GroupManagementAgent to an application domain + sub-domain- Specified by:
addGroupManagementAgentin 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:ClusteringAgentGet the GroupManagementAgent which corresponds to theapplicationDomainThis will be valid only when this node is running in groupManagement- Specified by:
getGroupManagementAgentin 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:ClusteringAgentGet the GroupManagementAgent which corresponds to theapplicationDomain + sub-domain- Specified by:
getGroupManagementAgentin 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:ClusteringAgentGet all the domains that this ClusteringAgent belongs to- Specified by:
getDomainsin interfaceClusteringAgent- Returns:
- the domains of this ClusteringAgent
-
getStateManager
public StateManager getStateManager()
- Specified by:
getStateManagerin interfaceClusteringAgent- Returns:
- The StateManager
-
getNodeManager
public NodeManager getNodeManager()
- Specified by:
getNodeManagerin interfaceClusteringAgent- Returns:
- The NodeManager
-
isCoordinator
public boolean isCoordinator()
Description copied from interface:ClusteringAgentChecks whether this member is the coordinator for the cluster- Specified by:
isCoordinatorin interfaceClusteringAgent- Returns:
- true if this member is the coordinator, and false otherwise
-
init
public void init() throws ClusteringFaultInitialize the cluster.- Specified by:
initin interfaceClusteringAgent- Throws:
ClusteringFault- If initialization fails
-
finalize
public void finalize()
Description copied from interface:ClusteringAgentDo cleanup & leave the cluster- Specified by:
finalizein interfaceClusteringAgent- Overrides:
finalizein classObject
-
sendMessage
public List<ClusteringCommand> sendMessage(ClusteringMessage message, boolean isRpcMessage) throws ClusteringFault
Description copied from interface:ClusteringAgentSend a message to all members in this member's primary cluster- Specified by:
sendMessagein 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:ClusteringAgentSet 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:
setNodeManagerin interfaceClusteringAgent- Parameters:
nodeManager- The NodeManager instance
-
setStateManager
public void setStateManager(StateManager stateManager)
Description copied from interface:ClusteringAgentSet 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:
setStateManagerin interfaceClusteringAgent- Parameters:
stateManager- The StateManager instance
-
addParameter
public void addParameter(Parameter param) throws AxisFault
Description copied from interface:ParameterIncludeMethod addParameter.- Specified by:
addParameterin interfaceParameterInclude- Throws:
AxisFault
-
deserializeParameters
public void deserializeParameters(OMElement parameterElement) throws AxisFault
- Specified by:
deserializeParametersin interfaceParameterInclude- Throws:
AxisFault
-
getParameter
public Parameter getParameter(String name)
Description copied from interface:ParameterIncludeMethod getParameter.- Specified by:
getParameterin interfaceParameterInclude- Returns:
- Returns Parameter.
-
getParameters
public ArrayList getParameters()
Description copied from interface:ParameterIncludeGets all the parameters in a given description.- Specified by:
getParametersin interfaceParameterInclude- Returns:
- Returns ArrayList.
-
isParameterLocked
public boolean isParameterLocked(String parameterName)
Description copied from interface:ParameterIncludeChecks whether the parameter is locked at any level.- Specified by:
isParameterLockedin interfaceParameterInclude
-
removeParameter
public void removeParameter(Parameter param) throws AxisFault
- Specified by:
removeParameterin interfaceParameterInclude- Throws:
AxisFault
-
shutdown
public void shutdown() throws ClusteringFaultShutdown the cluster. This member will leave the cluster when this method is called.- Specified by:
shutdownin interfaceClusteringAgent- Throws:
ClusteringFault- If an error occurs while shutting down
-
setConfigurationContext
public void setConfigurationContext(ConfigurationContext configurationContext)
Description copied from interface:ClusteringAgentSet 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:
setConfigurationContextin 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
-
-