站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 cluster API Documentation 英文版文档

HASingletonSupport (JBoss Cluster API) - JBoss 4.0.1 sp1 cluster API Documentation 英文版文档


org.jboss.ha.singleton
Class HASingletonSupport

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.ha.jmx.HAServiceMBeanSupport
              extended byorg.jboss.ha.singleton.HASingletonSupport
All Implemented Interfaces:
HAServiceMBean, HASingleton, HASingletonMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean
Direct Known Subclasses:
HASingletonController

public class HASingletonSupport
extends HAServiceMBeanSupport
implements HASingletonMBean, HASingleton

Management Bean for an HA-Singleton service.

Version:
$Revision: 1.4 $
Author:
Ivelin Ivanov Scott.Stark@jboss.org

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
HASingletonSupport()
           
 
Method Summary
 void _stopOldMaster()
          This method will be invoked twice by the local node when it stops as well as by the remote
 boolean isMasterNode()
           
protected  void makeThisNodeMaster()
           
 void partitionTopologyChanged(List newReplicants, int newViewID)
          When topology changes, a new master is elected based on the result of the isDRMMasterReplica() call.
 void startSingleton()
           Extending classes should override this method and implement the custom singleton logic.
 void stopSingleton()
          Extending classes should override this method and implement the custom singleton logic.
 
Methods inherited from class org.jboss.ha.jmx.HAServiceMBeanSupport
_receiveRemoteNotification, callAsyncMethodOnPartition, callMethodOnPartition, callMethodOnPartition, findHAPartitionWithName, getDistributedState, getPartition, getPartitionName, getServiceHAName, isDRMMasterReplica, registerDRMListener, registerRPCHandler, sendNotification, sendNotificationRemote, sendNotificationToLocalListeners, setDistributedState, setPartitionName, setupPartition, startService, stopService, unregisterDRMListener, unregisterRPCHandler
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.ha.jmx.HAServiceMBean
callMethodOnPartition, getDistributedState, getPartitionName, sendNotification, setDistributedState, setPartitionName
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Constructor Detail

HASingletonSupport

public HASingletonSupport()
Method Detail

isMasterNode

public boolean isMasterNode()
Specified by:
isMasterNode in interface HASingletonMBean
Returns:
true if this cluster node has the active mbean singleton. false otherwise

startSingleton

public void startSingleton()

Extending classes should override this method and implement the custom singleton logic. Only one node in the cluster is the active master. If the current node is elected for master, this method is invoked. When another node is elected for master for some reason, the stopSingleton() method is invokded.

When the extending class is a stateful singleton, it will usually use putDistributedState() and getDistributedState() to save in the cluster environment information that will be needed by the next node elected for master should the current master node fail.

Specified by:
startSingleton in interface HASingleton
See Also:
HASingleton

stopSingleton

public void stopSingleton()
Extending classes should override this method and implement the custom singleton logic. Only one node in the cluster is the active master. If the current node is master and another node is elected for master, this method is invoked.

Specified by:
stopSingleton in interface HASingleton
See Also:
HASingleton

partitionTopologyChanged

public void partitionTopologyChanged(List newReplicants,
                                     int newViewID)
When topology changes, a new master is elected based on the result of the isDRMMasterReplica() call.

Overrides:
partitionTopologyChanged in class HAServiceMBeanSupport
See Also:
HAServiceMBeanSupport.partitionTopologyChanged(List, int), DistributedReplicantManager#isMasterReplica(String);

makeThisNodeMaster

protected void makeThisNodeMaster()

_stopOldMaster

public void _stopOldMaster()
This method will be invoked twice by the local node when it stops as well as by the remote



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.