Interface ClusteringAgent
-
- All Superinterfaces:
ParameterInclude
- All Known Implementing Classes:
TribesClusteringAgent
public interface ClusteringAgent extends ParameterInclude
This is the main interface in the Axis2 clustering implementation. In order to plug-in a new clustering implementation, this interface has to be implemented.
The initilization of a node in the cluster is handled here. It is also responsible for getting this node to join the cluster. This node should not process any Web services requests until it successfully joins the cluster. Generally, this node will also need to obtain the state information and/or configuration information from a neighboring node. This interface is also responsible for properly instantiating a
StateManager
&NodeManager
. In the case of a static membership scheme, this members are read from the axis2.xml file and added to the ClusteringAgent.In the axis2.xml, the instance of this interface is specified using the "clustering" class attribute. e.g.
<clustering class="org.apache.axis2.clustering.tribes.TribesClusterAgent"> There can also be several "parameter" elements, which are children of the "clustering" element in the axis2.xml file. Generally, these parameters will be specific to the ClusteringAgent implementation.
-
-
Method Summary
All Methods Instance Methods Abstract 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
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()
StateManager
getStateManager()
void
init()
Initialize this node, and join the clusterboolean
isCoordinator()
Checks whether this member is the coordinator for the clusterList<ClusteringCommand>
sendMessage(ClusteringMessage msg, 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()
Disconnect this node from the cluster.-
Methods inherited from interface org.apache.axis2.description.ParameterInclude
addParameter, deserializeParameters, getParameter, getParameters, isParameterLocked, removeParameter
-
-
-
-
Method Detail
-
init
void init() throws ClusteringFault
Initialize this node, and join the cluster- Throws:
ClusteringFault
- If an error occurs while initializing this node or joining the cluster
-
finalize
void finalize()
Do cleanup & leave the cluster
-
getStateManager
StateManager getStateManager()
- Returns:
- The StateManager
-
getNodeManager
NodeManager getNodeManager()
- Returns:
- The NodeManager
-
setStateManager
void setStateManager(StateManager stateManager)
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.- Parameters:
stateManager
- The StateManager instance
-
setNodeManager
void setNodeManager(NodeManager nodeManager)
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.- Parameters:
nodeManager
- The NodeManager instance
-
shutdown
void shutdown() throws ClusteringFault
Disconnect this node from the cluster. This node will no longer receive membership change notifications, state change messages or configuration change messages. The node will be " "standing alone" once it is shutdown. However, it has to continue to process Web service requests.- Throws:
ClusteringFault
- If an error occurs while leaving the cluster
-
setConfigurationContext
void setConfigurationContext(ConfigurationContext configurationContext)
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- Parameters:
configurationContext
- The configuration context
-
setMembers
void setMembers(List<Member> members)
Set the static members of the cluster. This is used only with static group membership- Parameters:
members
- Members to be added
-
getMembers
List<Member> getMembers()
Get the list of members in a static group- Returns:
- The members if static group membership is used. If any other membership scheme is used, the values returned may not be valid
-
getAliveMemberCount
int getAliveMemberCount()
Get the number of members alive.- Returns:
- the number of members alive.
-
addGroupManagementAgent
void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)
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- Parameters:
agent
- The GroupManagementAgent to be addedapplicationDomain
- The application domain which is handled by the GroupManagementAgent
-
addGroupManagementAgent
void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain, String applicationSubDomain)
Add a GroupManagementAgent to an application domain + sub-domain- 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
GroupManagementAgent getGroupManagementAgent(String applicationDomain)
Get the GroupManagementAgent which corresponds to theapplicationDomain
This will be valid only when this node is running in groupManagement- Parameters:
applicationDomain
- The application domain to which the application nodes being load balanced belong to- Returns:
- GroupManagementAgent which corresponds to the
applicationDomain
-
getGroupManagementAgent
GroupManagementAgent getGroupManagementAgent(String applicationDomain, String applicationSubDomain)
Get the GroupManagementAgent which corresponds to theapplicationDomain + sub-domain
- 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
Set<String> getDomains()
Get all the domains that this ClusteringAgent belongs to- Returns:
- the domains of this ClusteringAgent
-
isCoordinator
boolean isCoordinator()
Checks whether this member is the coordinator for the cluster- Returns:
- true if this member is the coordinator, and false otherwise
-
sendMessage
List<ClusteringCommand> sendMessage(ClusteringMessage msg, boolean isRpcMessage) throws ClusteringFault
Send a message to all members in this member's primary cluster- Parameters:
msg
- 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
-
-