org.jboss.test.ha.singleton
Class HASingletonSupportTester

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.ha.jmx.HAServiceMBeanSupport (src) 
              extended byorg.jboss.ha.singleton.HASingletonSupport (src) 
                  extended byorg.jboss.test.ha.singleton.HASingletonSupportTester
All Implemented Interfaces:
HAServiceMBean (src) , HASingleton (src) , HASingletonMBean (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)

public class HASingletonSupportTester
extends HASingletonSupport (src)


Field Summary
 java.util.Stack __invokationStack__
           
 boolean __isDRMMasterReplica__
           
 boolean __isSingletonStarted__
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
HASingletonSupportTester()
           
 
Method Summary
 void callMethodOnPartition(java.lang.String methodName, java.lang.Object[] args)
          Convenience method for broadcasting a call to all members of a partition.
protected  boolean isDRMMasterReplica()
           
protected  void makeThisNodeMaster()
           
protected  void registerDRMListener()
           
protected  void registerRPCHandler()
           
 void sendNotification(Notification (src)  notification)
          Broadcast the notification to the remote listener nodes (if any) and then invoke super.sendNotification() to notify local listeners.
protected  void setupPartition()
           
 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.
protected  void unregisterDRMListener()
           
protected  void unregisterRPCHandler()
           
 
Methods inherited from class org.jboss.ha.singleton.HASingletonSupport (src)
_stopOldMaster, isMasterNode, partitionTopologyChanged
 
Methods inherited from class org.jboss.ha.jmx.HAServiceMBeanSupport (src)
_receiveRemoteNotification, callAsyncMethodOnPartition, callMethodOnPartition, findHAPartitionWithName, getDistributedState, getPartition, getPartitionName, getServiceHAName, sendNotificationRemote, sendNotificationToLocalListeners, setDistributedState, setPartitionName, startService, stopService
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
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 (src)
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 (src)
getDistributedState, getPartitionName, setDistributedState, setPartitionName
 
Methods inherited from interface org.jboss.system.ServiceMBean (src)
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 
Methods inherited from interface javax.management.NotificationBroadcaster (src)
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Field Detail

__invokationStack__

public java.util.Stack __invokationStack__

__isDRMMasterReplica__

public boolean __isDRMMasterReplica__

__isSingletonStarted__

public boolean __isSingletonStarted__
Constructor Detail

HASingletonSupportTester

public HASingletonSupportTester()
Method Detail

setupPartition

protected void setupPartition()
                       throws java.lang.Exception
Overrides:
setupPartition in class HAServiceMBeanSupport (src)
Throws:
java.lang.Exception

registerRPCHandler

protected void registerRPCHandler()
Overrides:
registerRPCHandler in class HAServiceMBeanSupport (src)

unregisterRPCHandler

protected void unregisterRPCHandler()
Overrides:
unregisterRPCHandler in class HAServiceMBeanSupport (src)

registerDRMListener

protected void registerDRMListener()
                            throws java.lang.Exception
Overrides:
registerDRMListener in class HAServiceMBeanSupport (src)
Throws:
java.lang.Exception

unregisterDRMListener

protected void unregisterDRMListener()
                              throws java.lang.Exception
Overrides:
unregisterDRMListener in class HAServiceMBeanSupport (src)
Throws:
java.lang.Exception

isDRMMasterReplica

protected boolean isDRMMasterReplica()
Overrides:
isDRMMasterReplica in class HAServiceMBeanSupport (src)

callMethodOnPartition

public void callMethodOnPartition(java.lang.String methodName,
                                  java.lang.Object[] args)
                           throws java.lang.Exception
Description copied from interface: HAServiceMBean (src)
Convenience method for broadcasting a call to all members of a partition.

Specified by:
callMethodOnPartition in interface HAServiceMBean (src)
Overrides:
callMethodOnPartition in class HAServiceMBeanSupport (src)
Parameters:
methodName -
args -
Throws:
java.lang.Exception

startSingleton

public void startSingleton()
Description copied from class: HASingletonSupport (src)

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 (src)
Overrides:
startSingleton in class HASingletonSupport (src)
See Also:
HASingleton (src)

stopSingleton

public void stopSingleton()
Description copied from class: HASingletonSupport (src)
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 (src)
Overrides:
stopSingleton in class HASingletonSupport (src)
See Also:
HASingleton (src)

makeThisNodeMaster

protected void makeThisNodeMaster()
Overrides:
makeThisNodeMaster in class HASingletonSupport (src)

sendNotification

public void sendNotification(Notification (src)  notification)
Description copied from interface: HAServiceMBean (src)
Broadcast the notification to the remote listener nodes (if any) and then invoke super.sendNotification() to notify local listeners.

Specified by:
sendNotification in interface HAServiceMBean (src)
Overrides:
sendNotification in class HAServiceMBeanSupport (src)
Parameters:
notification - sent out to local listeners and other nodes. It should be serializable. It is recommended that the source of the notification is an ObjectName of an MBean that is is available on all nodes where the broadcaster MBean is registered.
See Also:
NotificationBroadcasterSupport.sendNotification(Notification)