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

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


org.jboss.ha.singleton
Class HASingletonController

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
                  extended byorg.jboss.ha.singleton.HASingletonController
All Implemented Interfaces:
HAServiceMBean, HASingleton, HASingletonControllerMBean, HASingletonMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class HASingletonController
extends HASingletonSupport
implements HASingletonControllerMBean

Allows singleton MBeans to be added declaratively at deployment time

Version:
$Revision: 1.3 $
Author:
Ivelin Ivanov , Scott.Stark@jboss.org, Marcus Redeker

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
HASingletonController()
           
 
Method Summary
 javax.management.ObjectName getTargetName()
           
 String getTargetStartMethod()
           
 String getTargetStartMethodArgument()
           
 String getTargetStopMethod()
           
 String getTargetStopMethodArgument()
           
protected  Object invokeSingletonMBeanMethod(javax.management.ObjectName name, String operationName, Object param)
           
 void setTargetName(javax.management.ObjectName targetObjectName)
          Sets the fully qualified JMX MBean Object Name of the Schedulable MBean to be called.
 void setTargetStartMethod(String targetStartMethod)
          Sets the start method name to be called on the Singleton MBean.
 void setTargetStartMethodArgument(String targetStartMethodArgument)
          Sets the argument to be passed to the start method of the Singleton MBean.
 void setTargetStopMethod(String targetStopMethod)
          Sets the stop method name to be called on the Singleton MBean.
 void setTargetStopMethodArgument(String targetStopMethodArgument)
          Sets the argument to be passed to the stop method of the Singleton MBean.
 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.singleton.HASingletonSupport
_stopOldMaster, isMasterNode, makeThisNodeMaster, partitionTopologyChanged
 
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.singleton.HASingletonMBean
isMasterNode
 
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

HASingletonController

public HASingletonController()
Method Detail

startSingleton

public void startSingleton()
Description copied from class: HASingletonSupport

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

stopSingleton

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

invokeSingletonMBeanMethod

protected Object invokeSingletonMBeanMethod(javax.management.ObjectName name,
                                            String operationName,
                                            Object param)
                                     throws javax.management.InstanceNotFoundException,
                                            javax.management.MBeanException,
                                            javax.management.ReflectionException
Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

getTargetName

public javax.management.ObjectName getTargetName()
Specified by:
getTargetName in interface HASingletonControllerMBean
Returns:
Object Name of the Target MBean for the timer notifications

setTargetName

public void setTargetName(javax.management.ObjectName targetObjectName)
Description copied from interface: HASingletonControllerMBean
Sets the fully qualified JMX MBean Object Name of the Schedulable MBean to be called.

Specified by:
setTargetName in interface HASingletonControllerMBean

getTargetStartMethod

public String getTargetStartMethod()
Specified by:
getTargetStartMethod in interface HASingletonControllerMBean
Returns:
start method description of the target MBean to be called

setTargetStartMethod

public void setTargetStartMethod(String targetStartMethod)
                          throws InvalidParameterException
Description copied from interface: HASingletonControllerMBean
Sets the start method name to be called on the Singleton MBean.

Specified by:
setTargetStartMethod in interface HASingletonControllerMBean
Throws:
InvalidParameterException

getTargetStopMethod

public String getTargetStopMethod()
Specified by:
getTargetStopMethod in interface HASingletonControllerMBean
Returns:
stop method description of the target MBean to be called

setTargetStopMethod

public void setTargetStopMethod(String targetStopMethod)
                         throws InvalidParameterException
Description copied from interface: HASingletonControllerMBean
Sets the stop method name to be called on the Singleton MBean.

Specified by:
setTargetStopMethod in interface HASingletonControllerMBean
Throws:
InvalidParameterException

getTargetStartMethodArgument

public String getTargetStartMethodArgument()
Specified by:
getTargetStartMethodArgument in interface HASingletonControllerMBean
Returns:
start method argument of the target MBean to be called

setTargetStartMethodArgument

public void setTargetStartMethodArgument(String targetStartMethodArgument)
Description copied from interface: HASingletonControllerMBean
Sets the argument to be passed to the start method of the Singleton MBean.

Specified by:
setTargetStartMethodArgument in interface HASingletonControllerMBean

getTargetStopMethodArgument

public String getTargetStopMethodArgument()
Specified by:
getTargetStopMethodArgument in interface HASingletonControllerMBean
Returns:
stop method argument of the target MBean to be called

setTargetStopMethodArgument

public void setTargetStopMethodArgument(String targetStopMethodArgument)
Description copied from interface: HASingletonControllerMBean
Sets the argument to be passed to the stop method of the Singleton MBean.

Specified by:
setTargetStopMethodArgument in interface HASingletonControllerMBean


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