org.jboss.ha.singleton
Class HASingletonController
java.lang.Object
org.jboss.mx.util.JBossNotificationBroadcasterSupport
org.jboss.system.ServiceMBeanSupport
org.jboss.ha.jmx.AbstractHAServiceMBeanSupport<org.jboss.ha.framework.interfaces.HASingleton<Notification>>
org.jboss.ha.singleton.HASingletonSupport
org.jboss.ha.singleton.HASingletonController
- All Implemented Interfaces:
- EventListener, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, org.jboss.ha.framework.interfaces.HAService<Notification>, org.jboss.ha.framework.interfaces.HAServiceKeyProvider, org.jboss.ha.framework.interfaces.HASingleton<Notification>, org.jboss.ha.framework.interfaces.HASingletonLifecycle, org.jboss.ha.framework.interfaces.HASingletonMBean, org.jboss.ha.framework.server.EventFacility<Notification>, org.jboss.ha.framework.server.EventFactory<Notification>, org.jboss.ha.framework.server.HAServiceRpcHandler<Notification>, org.jboss.ha.framework.server.HASingletonRpcHandler<Notification>, HAServiceMBean, HASingletonControllerMBean, HASingletonSupportMBean, org.jboss.kernel.spi.dependency.KernelControllerContextAware, Service, ServiceMBean
public class HASingletonController
- extends HASingletonSupport
- implements HASingletonControllerMBean
A clustered singleton service that calls a configurable
method on a target (m)bean, whenever the current node becomes
the master. Correspondingly, it calls a configurable method
on the target (m)bean, whenever the current node resigns from
being the master.
Optional string arguments may be passed to those methods.
- Version:
- $Revision: 81001 $
- Author:
- Ivelin Ivanov, Scott Stark, Marcus Redeker, Dimitris Andreadis, Brian Stansberry
Fields inherited from interface org.jboss.ha.framework.interfaces.HASingleton |
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 |
Methods inherited from class org.jboss.ha.jmx.AbstractHAServiceMBeanSupport |
callAsyncMethodOnPartition, callMethodOnPartition, createEvent, createService, destroyService, getDistributedState, getHAPartition, getHAService, getHAServiceKey, getPartitionName, getSendLocalLifecycleNotifications, getSendRemoteLifecycleNotifications, getServiceHAName, handleEvent, isRegisterThreadContextClassLoader, notifyListeners, sendNotification, sendNotificationRemote, sendNotificationToLocalListeners, setClusterPartition, setDistributedState, setHAPartition, setRegisterThreadContextClassLoader, setSendLocalLifecycleNotifications, setSendRemoteLifecycleNotifications, setServiceHAName, setupPartition, startService, stopService |
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
create, destroy, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, pojoChange, pojoCreate, pojoDestroy, pojoStart, pojoStop, postDeregister, postRegister, preDeregister, preRegister, setKernelControllerContext, start, stop, unsetKernelControllerContext |
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.framework.interfaces.HASingleton |
getElectionPolicy, getRestartOnMerge, setElectionPolicy, setRestartOnMerge |
Methods inherited from interface org.jboss.ha.framework.interfaces.HAService |
create, destroy, getServiceHAName, isRegisterThreadContextClassLoader, setHAPartition, setRegisterThreadContextClassLoader, setServiceHAName, start, stop |
Methods inherited from interface org.jboss.ha.framework.interfaces.HAServiceKeyProvider |
getHAPartition, getHAServiceKey |
Methods inherited from interface org.jboss.ha.framework.interfaces.EventListener |
handleEvent |
Methods inherited from interface org.jboss.ha.framework.interfaces.HASingletonMBean |
isMasterNode |
HASingletonController
public HASingletonController()
getTarget
public Object getTarget()
- Description copied from interface:
HASingletonControllerMBean
- Gets controlled target singleton
- Specified by:
getTarget
in interface HASingletonControllerMBean
- Returns:
- the singleton, or
null
if this object is
configured to use a
JMX object name
.
setTarget
public void setTarget(Object target)
- Description copied from interface:
HASingletonControllerMBean
- Sets the controlled target singleton
- Specified by:
setTarget
in interface HASingletonControllerMBean
getTargetName
public ObjectName getTargetName()
- Description copied from interface:
HASingletonControllerMBean
- Gets the ObjectName of the controlled target Singleton MBean
- Specified by:
getTargetName
in interface HASingletonControllerMBean
- Returns:
- the target object name, or
null
if this object is
configured via HASingletonControllerMBean.setTarget(Object)
.
setTargetName
public void setTargetName(ObjectName targetObjectName)
- Description copied from interface:
HASingletonControllerMBean
- Sets the ObjectName of the controlled target Singleton MBean
- Specified by:
setTargetName
in interface HASingletonControllerMBean
- Parameters:
targetObjectName
- target of the MBean singleton
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 org.jboss.ha.framework.interfaces.HASingletonLifecycle
- Overrides:
startSingleton
in class HASingletonSupport
- See Also:
HASingletonSupport.startSingleton()
stopSingleton
public void stopSingleton()
- Call the target stop method
- Specified by:
stopSingleton
in interface org.jboss.ha.framework.interfaces.HASingletonLifecycle
- Overrides:
stopSingleton
in class HASingletonSupport
- See Also:
HASingletonSupport.stopSingleton()
invokeSingletonMethod
protected Object invokeSingletonMethod(Object target,
String operationName,
Object param)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
- Throws:
IllegalAccessException
InvocationTargetException
NoSuchMethodException
invokeSingletonMBeanMethod
protected Object invokeSingletonMBeanMethod(ObjectName target,
String operationName,
Object param)
throws InstanceNotFoundException,
MBeanException,
ReflectionException
- Throws:
InstanceNotFoundException
MBeanException
ReflectionException
getTargetMethod
public static Method getTargetMethod(Object target,
String methodName,
Class<?>[] types)
throws NoSuchMethodException
- Throws:
NoSuchMethodException
Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.