org.jboss.ha.singleton
Class HASingletonController

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

public class HASingletonController
extends HASingletonSupport
implements HASingletonControllerMBean

A clustered singleton service that calls a configurable method on a target mbean, whenever the current node becomes the master. Correspondigly, it calls a configurable method on the target mbean, whenever the current node resigns from being the master. Optional string arguments may be passed to those methods. The prevailing usage of this MBean is to deploy on the master node the content of the deploy-hasingleton directory.

Version:
$Revision: 1.3.8.2 $
Author:
Ivelin Ivanov, Scott Stark, Marcus Redeker, Dimitris Andreadis

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.ha.singleton.HASingletonMBean
HASINGLETON_STARTED_NOTIFICATION, HASINGLETON_STARTING_NOTIFICATION, HASINGLETON_STOPPED_NOTIFICATION, HASINGLETON_STOPPING_NOTIFICATION
 
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()
          Default CTOR
 
Method Summary
 javax.management.ObjectName getTargetName()
          The controlled target Singleton MBean
 String getTargetStartMethod()
          The target method to call when the Singleton is started
 String getTargetStartMethodArgument()
          The argument to pass to the start method of the singleton MBean
 String getTargetStopMethod()
          The target method to call when the Singleton is stopped
 String getTargetStopMethodArgument()
          The argument to pass to the stop method of the singleton MBean
protected  Object invokeSingletonMBeanMethod(javax.management.ObjectName target, String operationName, Object param)
           
 void setTargetName(javax.management.ObjectName targetObjectName)
           
 void setTargetStartMethod(String targetStartMethod)
           
 void setTargetStartMethodArgument(String targetStartMethodArgument)
           
 void setTargetStopMethod(String targetStopMethod)
           
 void setTargetStopMethodArgument(String targetStopMethodArgument)
           
 void startSingleton()
          Call the target start method
 void stopSingleton()
          Call the target stop method
 
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, getClusterPartition, getDistributedState, getPartition, getPartitionName, getServiceHAName, isDRMMasterReplica, registerDRMListener, registerRPCHandler, sendNotification, sendNotificationRemote, sendNotificationToLocalListeners, setClusterPartition, setDistributedState, setPartitionName, setupPartition, startService, stopService, unregisterDRMListener, unregisterRPCHandler
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, 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, nextNotificationSequenceNumber, 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, getClusterPartition, getDistributedState, getPartitionName, sendNotification, setClusterPartition, 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()
Default CTOR

Method Detail

getTargetName

public javax.management.ObjectName getTargetName()
Description copied from interface: HASingletonControllerMBean
The controlled target Singleton MBean

Specified by:
getTargetName in interface HASingletonControllerMBean

setTargetName

public void setTargetName(javax.management.ObjectName targetObjectName)
Specified by:
setTargetName in interface HASingletonControllerMBean

getTargetStartMethod

public String getTargetStartMethod()
Description copied from interface: HASingletonControllerMBean
The target method to call when the Singleton is started

Specified by:
getTargetStartMethod in interface HASingletonControllerMBean

setTargetStartMethod

public void setTargetStartMethod(String targetStartMethod)
                          throws InvalidParameterException
Specified by:
setTargetStartMethod in interface HASingletonControllerMBean
Throws:
InvalidParameterException

getTargetStopMethod

public String getTargetStopMethod()
Description copied from interface: HASingletonControllerMBean
The target method to call when the Singleton is stopped

Specified by:
getTargetStopMethod in interface HASingletonControllerMBean

setTargetStopMethod

public void setTargetStopMethod(String targetStopMethod)
                         throws InvalidParameterException
Specified by:
setTargetStopMethod in interface HASingletonControllerMBean
Throws:
InvalidParameterException

getTargetStartMethodArgument

public String getTargetStartMethodArgument()
Description copied from interface: HASingletonControllerMBean
The argument to pass to the start method of the singleton MBean

Specified by:
getTargetStartMethodArgument in interface HASingletonControllerMBean

setTargetStartMethodArgument

public void setTargetStartMethodArgument(String targetStartMethodArgument)
Specified by:
setTargetStartMethodArgument in interface HASingletonControllerMBean

getTargetStopMethodArgument

public String getTargetStopMethodArgument()
Description copied from interface: HASingletonControllerMBean
The argument to pass to the stop method of the singleton MBean

Specified by:
getTargetStopMethodArgument in interface HASingletonControllerMBean

setTargetStopMethodArgument

public void setTargetStopMethodArgument(String targetStopMethodArgument)
Specified by:
setTargetStopMethodArgument in interface HASingletonControllerMBean

startSingleton

public void startSingleton()
Call the target start method

Specified by:
startSingleton in interface HASingleton
Overrides:
startSingleton in class HASingletonSupport
See Also:
HASingletonSupport.startSingleton()

stopSingleton

public void stopSingleton()
Call the target stop method

Specified by:
stopSingleton in interface HASingleton
Overrides:
stopSingleton in class HASingletonSupport
See Also:
HASingletonSupport.stopSingleton()

invokeSingletonMBeanMethod

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


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