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.
specifies that the TribesClusterAgent class is the instance of this interface that
needs to be used.
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.
Modifier and Type | Method and 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-domain
|
void |
finalize()
Do cleanup & leave the cluster
|
int |
getAliveMemberCount()
Get the number of members alive.
|
Set<String> |
getDomains()
Get all the domains that this ClusteringAgent belongs to
|
GroupManagementAgent |
getGroupManagementAgent(String applicationDomain)
Get the GroupManagementAgent which corresponds to the
applicationDomain
This will be valid only when this node is running in groupManagement |
GroupManagementAgent |
getGroupManagementAgent(String applicationDomain,
String applicationSubDomain)
Get the GroupManagementAgent which corresponds to the
applicationDomain + sub-domain |
List<Member> |
getMembers()
Get the list of members in a
static group
|
NodeManager |
getNodeManager() |
StateManager |
getStateManager() |
void |
init()
Initialize this node, and join the cluster
|
boolean |
isCoordinator()
Checks whether this member is the coordinator for the cluster
|
List<ClusteringCommand> |
sendMessage(ClusteringMessage msg,
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()
Disconnect this node from the cluster.
|
addParameter, deserializeParameters, getParameter, getParameters, isParameterLocked, removeParameter
void init() throws ClusteringFault
ClusteringFault
- If an error occurs while initializing this node or joining the clustervoid finalize()
StateManager getStateManager()
NodeManager getNodeManager()
void setStateManager(StateManager stateManager)
ClusterBuilder
, by
reading the "contextManager" element in the axis2.xml
e.g.
stateManager
- The StateManager instancevoid setNodeManager(NodeManager nodeManager)
ClusterBuilder
, by
reading the "configurationManager" element in the axis2.xml
e.g.
nodeManager
- The NodeManager instancevoid shutdown() throws ClusteringFault
ClusteringFault
- If an error occurs while leaving the clustervoid setConfigurationContext(ConfigurationContext configurationContext)
configurationContext
- The configuration contextvoid setMembers(List<Member> members)
members
- Members to be addedList<Member> getMembers()
int getAliveMemberCount()
void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)
agent
- The GroupManagementAgent to be addedapplicationDomain
- The application domain which is handled by the GroupManagementAgentvoid addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain, String applicationSubDomain)
agent
- The GroupManagementAgent to be addedapplicationDomain
- The application domain which is handled by the GroupManagementAgentapplicationSubDomain
- The application sub-domain which is handled by the GroupManagementAgentGroupManagementAgent getGroupManagementAgent(String applicationDomain)
applicationDomain
This will be valid only when this node is running in groupManagementapplicationDomain
- The application domain to which the application nodes being
load balanced belong toapplicationDomain
GroupManagementAgent getGroupManagementAgent(String applicationDomain, String applicationSubDomain)
applicationDomain + sub-domain
applicationDomain
- The application domain which is handled by the GroupManagementAgentapplicationSubDomain
- The application sub-domain which is handled by the GroupManagementAgentapplicationDomain + sub-domain
Set<String> getDomains()
boolean isCoordinator()
List<ClusteringCommand> sendMessage(ClusteringMessage msg, boolean isRpcMessage) throws ClusteringFault
msg
- The message to be sentisRpcMessage
- Indicates whether the message has to be sent in RPC modeClusteringFault
- If an error occurs while sending the messageCopyright © 2004–2018 The Apache Software Foundation. All rights reserved.