Interface StateManager
-
- All Superinterfaces:
ParameterInclude
- All Known Implementing Classes:
DefaultStateManager
public interface StateManager extends ParameterInclude
This interface is responsible for handling context replication. The property changes in the Axis2 context hierarchy in this node, are propagated to all other nodes in the cluster.
It is not mandatory to have a StateManager in a node. If we are not interested in High Availability, we may disable context replication by commenting out the "contextManager" section in the axis2.xml cluster configuration section. In such a scenatio, the cluster will be used only for the purpose of Scalability
The implementation of this interface is set by the
e.g.ClusterBuilder
, by reading the "contextManager" element in the axis2.xml
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map
getReplicationExcludePatterns()
Get all the excluded context property name patternsboolean
isContextClusterable(AbstractContext context)
This is a check to see whether the properties in an instance ofAbstractContext
should be replicated.void
removeContext(AbstractContext context)
This method is called whenAbstractContext
is removed from the systemvoid
replicateState(StateClusteringCommand command)
Replicate state using a custom StateClusteringCommandvoid
setConfigurationContext(ConfigurationContext configurationContext)
Set the system's configuration context.void
setReplicationExcludePatterns(String contextType, List patterns)
All properties in the context with typecontextType
which have names that match the specified pattern will be excluded from replication.void
updateContext(AbstractContext context)
This method is called when properties in anAbstractContext
are updated.void
updateContext(AbstractContext context, String[] propertyNames)
This method is called when one need to update/replicate only certains properties in the specifiedcontext
void
updateContexts(AbstractContext[] contexts)
This method is called when properties in a collection ofAbstractContext
s are updated.-
Methods inherited from interface org.apache.axis2.description.ParameterInclude
addParameter, deserializeParameters, getParameter, getParameters, isParameterLocked, removeParameter
-
-
-
-
Method Detail
-
updateContext
void updateContext(AbstractContext context) throws ClusteringFault
This method is called when properties in anAbstractContext
are updated. This could be addition of new properties, modifications of existing properties or removal of properties.- Parameters:
context
- The context to be replicated- Throws:
ClusteringFault
- If replication fails
-
updateContext
void updateContext(AbstractContext context, String[] propertyNames) throws ClusteringFault
This method is called when one need to update/replicate only certains properties in the specifiedcontext
- Parameters:
context
- The AbstractContext containing the properties to be replicatedpropertyNames
- The names of the specific properties that should be replicated- Throws:
ClusteringFault
- If replication fails
-
updateContexts
void updateContexts(AbstractContext[] contexts) throws ClusteringFault
This method is called when properties in a collection ofAbstractContext
s are updated. This could be addition of new properties, modifications of existing properties or removal of properties.- Parameters:
contexts
- The AbstractContexts containing the properties to be replicated- Throws:
ClusteringFault
- If replication fails
-
replicateState
void replicateState(StateClusteringCommand command) throws ClusteringFault
Replicate state using a custom StateClusteringCommand- Parameters:
command
- The custom StateClusteringCommand which can be used for replicating state- Throws:
ClusteringFault
- If replication fails
-
removeContext
void removeContext(AbstractContext context) throws ClusteringFault
This method is called whenAbstractContext
is removed from the system- Parameters:
context
- The AbstractContext to be removed- Throws:
ClusteringFault
- If context removal fails
-
isContextClusterable
boolean isContextClusterable(AbstractContext context)
This is a check to see whether the properties in an instance ofAbstractContext
should be replicated. This allows an implementer to dissallow the replication of properties stored in a certain type of context- Parameters:
context
- The instance of AbstractContext under consideration- Returns:
- True - if the provided
AbstractContext
is clusterable
-
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
-
setReplicationExcludePatterns
void setReplicationExcludePatterns(String contextType, List patterns)
All properties in the context with type
contextType
which have names that match the specified pattern will be excluded from replication.Only prefixes and suffixes are allowed. e.g. the local_* pattern indicates that all property names starting with local_ should be omitted from replication. *_local pattern indicated that all property names ending with _local should be omitted from replication. * pattern indicates that all properties should be excluded.
Generally, we can use the context class name as the context type.
- Parameters:
contextType
- The type of the context such as org.apache.axis2.context.ConfigurationContext, org.apache.axis2.context.ServiceGroupContext & org.apache.axis2.context.ServiceContext. Also "defaults" is a special type, which will apply to all contextspatterns
- The patterns
-
getReplicationExcludePatterns
Map getReplicationExcludePatterns()
Get all the excluded context property name patterns- Returns:
- All the excluded pattern of all the contexts. The key of the Map is the
the
contextType
. SeesetReplicationExcludePatterns(String,List)
. The values are of typeList
ofString
Objects, which are a collection of patterns to be excluded. - See Also:
setReplicationExcludePatterns(String, java.util.List)
-
-