|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.engine.cluster.ClusterManager
public final class ClusterManager
The manager instance for a cluster node.
Each xmlBlaster server instance has one instance of this class to manage its behavior in the cluster. Note: Our own node id is available via glob.getNodeId() See the cluster requirement for a detailed description.
Nested Class Summary | |
---|---|
(package private) class |
ClusterManager.NodeComparator
Sorts the cluster nodes for the clusterNodeMap First is the local node Others by node id |
Field Summary | |
---|---|
private boolean |
allowDirectLoopback
If sender node == destination node throw exception back (circular loop) If configured to true (behaviour befor 2008-10-09) the message is send back and there the loop is detected and error handled. |
private java.util.Map |
clusterNodeMap
Map containing ClusterNode objects, the key is a 'node Id' The entries are sorted to contain the local node as first entry. |
private ClusterNode[] |
clusterNodesCache
|
private ContextNode |
contextNode
|
private ServerScope |
glob
|
private boolean |
lazyConnect
Usually connecting on demand is enough (e.g. |
private I_LoadBalancer |
loadBalancer
|
private LoadBalancerPluginManager |
loadBalancerPluginManager
|
private static java.util.logging.Logger |
log
|
private MapMsgToMasterPluginManager |
mapMsgToMasterPluginManager
|
private java.lang.Object |
mbeanHandle
My JMX registration |
private java.lang.String |
ME
|
private ClusterNode |
myClusterNode
Info about myself |
private PluginInfo |
pluginInfo
|
java.lang.String |
pluginLoadBalancerType
|
java.lang.String |
pluginLoadBalancerVersion
|
private boolean |
postInitialized
|
private SessionInfo |
sessionInfo
|
Constructor Summary | |
---|---|
ClusterManager()
If loaded by RunlevelManager. |
|
ClusterManager(ServerScope glob,
SessionInfo sessionInfo)
You need to call postInit() after all drivers are loaded. |
Method Summary | |
---|---|
void |
addClusterNode(ClusterNode clusterNode)
Add a new node info object or overwrite an existing one. |
java.lang.String |
addClusterNode(java.lang.String xml)
|
EraseReturnQos[] |
forwardErase(SessionInfo publisherSession,
QueryKeyData xmlKey,
EraseQosServer eraseQos)
|
MsgUnit[] |
forwardGet(SessionInfo publisherSession,
QueryKeyData xmlKey,
GetQosServer getQos)
|
PublishReturnQos |
forwardPtpPublish(SessionInfo publisherSession,
MsgUnit msgUnit,
Destination destination)
|
PublishRetQosWrapper |
forwardPublish(SessionInfo publisherSession,
MsgUnit msgUnit)
|
SubscribeReturnQos |
forwardSubscribe(SessionInfo publisherSession,
QueryKeyData xmlKey,
SubscribeQosServer subscribeQos)
|
UnSubscribeReturnQos[] |
forwardUnSubscribe(SessionInfo publisherSession,
QueryKeyData xmlKey,
UnSubscribeQosServer unSubscribeQos)
|
ClusterNode |
getClusterNode(NodeId nodeId)
Access the informations belonging to a node id |
ClusterNode |
getClusterNode(java.lang.String id)
Access the informations belonging to a node id |
ClusterNode |
getClusterNodeIntermediate(NodeId nodeId)
If a destination node is not known, we can try to use another node for hopping, probably this node knows how to route further |
ClusterNode[] |
getClusterNodes()
Return array containing all known cluster nodes. |
I_XmlBlasterAccess |
getConnection(NodeId nodeId)
|
NodeMasterInfo |
getConnection(SessionInfo publisherSession,
MsgUnit msgUnit)
|
NodeMasterInfo |
getConnection(SessionInfo publisherSession,
MsgUnit msgUnit,
Destination destination)
Get connection to the master node (or a node at a closer stratum to the master). |
ContextNode |
getContextNode()
|
java.lang.String |
getId()
Access the unique cluster node id (as a String). |
MapMsgToMasterPluginManager |
getMapMsgToMasterPluginManager()
The plugin loader instance to map messages to their master node. |
ClusterNode |
getMyClusterNode()
Return myself |
java.lang.String |
getName()
A human readable name of the listener for logging. |
NodeId |
getNodeId()
Access the unique cluster node id (as NodeId object). |
java.lang.String |
getNodeList()
Access a list of known cluster nodes e.g. |
java.lang.String[] |
getNodes()
Access a list of known cluster nodes e.g. |
int |
getNumNodes()
|
java.lang.String |
getType()
Enforced by I_Plugin |
java.lang.String |
getUsageUrl()
|
java.lang.String |
getVersion()
Enforced by I_Plugin |
void |
init(Global globUtil,
PluginInfo pluginInfo)
This method is called by the PluginManager (enforced by I_Plugin). |
private void |
initConnections()
Usually the connection is established on demand (a message wants to travel to a node). |
private void |
initMyselfClusterNode()
Initialize ClusterNode object, containing all informations about myself. |
boolean |
isLocalAddress(Address other)
Check if supplied address would connect to our own node. |
boolean |
isReady()
|
boolean |
isShutdown()
Check status |
void |
postInit()
To initialize ClusterNode we need the addresses from the protocol drivers. |
private void |
publish()
TODO: not implemented yet You can't currently configure the cluster setup with messages, only statically on startup |
void |
removeClusterNode(ClusterNode clusterNode)
|
void |
runlevelChange(int from,
int to,
boolean force)
Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING Enforced by I_RunlevelListener |
void |
setUsageUrl(java.lang.String url)
|
void |
shutdown()
Shutdown the plugin, free resources. |
static java.lang.String |
staticUsage()
Command line usage. |
private void |
subscribe()
TODO: not implemented yet You can't currently configure the cluster setup with messages, only statically on startup |
java.lang.String |
toXml()
Dump state of this object into a XML ASCII string. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string. |
java.lang.String |
usage()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String ME
private ServerScope glob
private static java.util.logging.Logger log
private SessionInfo sessionInfo
private MapMsgToMasterPluginManager mapMsgToMasterPluginManager
private LoadBalancerPluginManager loadBalancerPluginManager
private I_LoadBalancer loadBalancer
public java.lang.String pluginLoadBalancerType
public java.lang.String pluginLoadBalancerVersion
private PluginInfo pluginInfo
private ContextNode contextNode
private java.lang.Object mbeanHandle
private java.util.Map clusterNodeMap
private ClusterNode[] clusterNodesCache
private ClusterNode myClusterNode
private boolean postInitialized
private boolean lazyConnect
private boolean allowDirectLoopback
Constructor Detail |
---|
public ClusterManager()
public ClusterManager(ServerScope glob, SessionInfo sessionInfo)
sessionInfo
- Internal handle to be used directly with RequestBroker
NOTE: We (the cluster code) are responsible for security checks
as we directly write into RequestBroker.Method Detail |
---|
public java.lang.String getType()
getType
in interface I_AdminPlugin
getType
in interface I_Plugin
public java.lang.String getVersion()
getVersion
in interface I_AdminPlugin
getVersion
in interface I_Plugin
public void init(Global globUtil, PluginInfo pluginInfo) throws XmlBlasterException
init
in interface I_Plugin
XmlBlasterException
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)
public void postInit() throws XmlBlasterException
XmlBlasterException
public boolean isReady()
private void publish()
private void subscribe()
private void initMyselfClusterNode() throws XmlBlasterException
XmlBlasterException
public final boolean isLocalAddress(Address other)
public ClusterNode getMyClusterNode()
public final NodeId getNodeId()
public final java.lang.String getId()
public MapMsgToMasterPluginManager getMapMsgToMasterPluginManager()
public PublishReturnQos forwardPtpPublish(SessionInfo publisherSession, MsgUnit msgUnit, Destination destination) throws XmlBlasterException
<qos><state id='OK' info='QUEUED[bilbo]'/></qos>if message is tailed back because cluster node is temporary not available. The message will be flushed on reconnect.
XmlBlasterException
- and RuntimeExceptions are just forwarded to the callerpublic PublishRetQosWrapper forwardPublish(SessionInfo publisherSession, MsgUnit msgUnit) throws XmlBlasterException
<qos><state id='OK' info='QUEUED[bilbo]'/></qos>if message is tailed back because cluster node is temporary not available. The message will be flushed on reconnect.
XmlBlasterException
- and RuntimeExceptions are just forwarded to the callerpublic SubscribeReturnQos forwardSubscribe(SessionInfo publisherSession, QueryKeyData xmlKey, SubscribeQosServer subscribeQos) throws XmlBlasterException
<qos><state id='OK' info='QUEUED[bilbo]'/></qos>if message is tailed back because cluster node is temporary not available. The message will be flushed on reconnect.
XmlBlasterException
- and RuntimeExceptions are just forwarded to the callerpublic UnSubscribeReturnQos[] forwardUnSubscribe(SessionInfo publisherSession, QueryKeyData xmlKey, UnSubscribeQosServer unSubscribeQos) throws XmlBlasterException
<qos><state id='OK' info='QUEUED[bilbo]'/></qos>if message is tailed back because cluster node is temporary not available. The message will be flushed on reconnect.
XmlBlasterException
- and RuntimeExceptions are just forwarded to the callerpublic MsgUnit[] forwardGet(SessionInfo publisherSession, QueryKeyData xmlKey, GetQosServer getQos) throws XmlBlasterException
XmlBlasterException
- and RuntimeExceptions are just forwarded to the callerpublic EraseReturnQos[] forwardErase(SessionInfo publisherSession, QueryKeyData xmlKey, EraseQosServer eraseQos) throws XmlBlasterException
<qos><state id='OK' info='QUEUED[bilbo]/></qos>if message is tailed back because cluster node is temporary not available. The command will be flushed on reconnect.
XmlBlasterException
- and RuntimeExceptions are just forwarded to the callerpublic final void addClusterNode(ClusterNode clusterNode)
The
- ClusterNode instance
java.lang.IllegalArgumentException
public final void removeClusterNode(ClusterNode clusterNode)
public ClusterNode[] getClusterNodes()
public int getNumNodes()
getNumNodes
in interface ClusterManagerMBean
public final java.lang.String getNodeList()
getNodeList
in interface ClusterManagerMBean
public final java.lang.String[] getNodes()
getNodes
in interface ClusterManagerMBean
public java.lang.String addClusterNode(java.lang.String xml)
addClusterNode
in interface ClusterManagerMBean
public final ClusterNode getClusterNode(NodeId nodeId)
public final ClusterNode getClusterNode(java.lang.String id)
The
- cluster node id as a string
public final ClusterNode getClusterNodeIntermediate(NodeId nodeId)
private void initConnections() throws XmlBlasterException
XmlBlasterException
public final NodeMasterInfo getConnection(SessionInfo publisherSession, MsgUnit msgUnit) throws XmlBlasterException
XmlBlasterException
public final NodeMasterInfo getConnection(SessionInfo publisherSession, MsgUnit msgUnit, Destination destination) throws XmlBlasterException
publisherSession
- can be nulldestination
- For PtP, else null
nodeMasterInfo.getClusterNode().getI_XmlBlasterAccess()
XmlBlasterException
public final I_XmlBlasterAccess getConnection(NodeId nodeId)
public void shutdown()
I_AdminPlugin
shutdown
in interface I_AdminPlugin
shutdown
in interface I_Plugin
public final java.lang.String toXml()
toXml
in interface ClusterManagerMBean
public final java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- indenting of tags for nice outputpublic java.lang.String getName()
getName
in interface I_RunlevelListener
public void runlevelChange(int from, int to, boolean force) throws XmlBlasterException
runlevelChange
in interface I_RunlevelListener
from
- The current runlevelto
- The runlevel we want to switch toforce
- If true force the change even if messages are lost
XmlBlasterException
public java.lang.String getUsageUrl()
getUsageUrl
in interface I_AdminUsage
public void setUsageUrl(java.lang.String url)
setUsageUrl
in interface I_AdminUsage
public java.lang.String usage()
usage
in interface I_AdminUsage
public boolean isShutdown()
I_AdminPlugin
isShutdown
in interface I_AdminPlugin
public static java.lang.String staticUsage()
java -Dproperty.verbose 2 ... java org.xmlBlaster.Main -property.verbose 2
public ContextNode getContextNode()
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |