|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.util.JBossNotificationBroadcasterSupport
org.jboss.system.ServiceMBeanSupport
org.jboss.ha.jmx.AbstractHAServiceMBeanSupport<S>
public abstract class AbstractHAServiceMBeanSupport<S extends org.jboss.ha.framework.interfaces.HAService<Notification>>
Abstract implementation of HAServiceMBean for use by subclasses, e.g. HASingletonSupport
.
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 | |
---|---|
AbstractHAServiceMBeanSupport()
|
Method Summary | |
---|---|
protected void |
callAsyncMethodOnPartition(String methodName,
Object[] args,
Class[] types)
|
List |
callMethodOnPartition(String methodName,
Object[] args,
Class[] types)
Convenience method for broadcasting a call to all members of a partition. |
Notification |
createEvent(Object source,
String type)
|
protected abstract S |
createHAService()
Defines the object used to delegate service methods. |
protected void |
createService()
|
protected void |
destroyService()
|
Serializable |
getDistributedState(String key)
Convenience method for sharing state across a cluster partition. |
org.jboss.ha.framework.interfaces.HAPartition |
getHAPartition()
|
protected S |
getHAService()
|
String |
getHAServiceKey()
|
String |
getPartitionName()
Gets the name of the partition used by this service. |
boolean |
getSendLocalLifecycleNotifications()
Gets whether JMX Notifications should be sent to local (same JVM) listeners if the notification is for an attribute change to attribute "State". |
boolean |
getSendRemoteLifecycleNotifications()
Gets whether JMX Notifications should be sent to remote listeners if the notification is for an attribute change to attribute "State". |
String |
getServiceHAName()
Override this method only if you need to provide a custom partition wide unique service name. |
void |
handleEvent(Notification notification)
|
boolean |
isRegisterThreadContextClassLoader()
|
void |
notifyListeners(Notification notification)
|
void |
sendNotification(Notification notification)
Broadcast the notification to the remote listener nodes (if any) and then invoke super.sendNotification() to notify local listeners. |
protected void |
sendNotificationRemote(Notification notification)
Broadcast a notifcation remotely to the partition participants |
protected void |
sendNotificationToLocalListeners(Notification notification)
|
void |
setClusterPartition(ClusterPartitionMBean clusterPartition)
Sets the underlying partition used by this service. |
void |
setDistributedState(String key,
Serializable value)
Convenience method for sharing state across a cluster partition. |
void |
setHAPartition(org.jboss.ha.framework.interfaces.HAPartition partition)
Sets the underlying partition used by this service. |
void |
setRegisterThreadContextClassLoader(boolean register)
|
void |
setSendLocalLifecycleNotifications(boolean sendLocalLifecycleNotifications)
Sets whether JMX Notifications should be sent to local (same JVM) listeners if the notification is for an attribute change to attribute "State". |
void |
setSendRemoteLifecycleNotifications(boolean sendRemoteLifecycleNotifications)
Sets whether JMX Notifications should be sent to remote listeners if the notification is for an attribute change to attribute "State". |
void |
setServiceHAName(String haName)
|
protected void |
setupPartition()
|
protected void |
startService()
Implementors of this method should not code the singleton logic here. |
protected void |
stopService()
Attention: Always call this method when you overwrite it in a subclass |
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.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 |
Methods inherited from interface org.jboss.ha.framework.interfaces.HAService |
---|
create, destroy, start, stop |
Constructor Detail |
---|
public AbstractHAServiceMBeanSupport()
Method Detail |
---|
protected abstract S createHAService()
HAService
delegateprotected final S getHAService()
createHAService()
.public org.jboss.ha.framework.interfaces.HAPartition getHAPartition()
getHAPartition
in interface org.jboss.ha.framework.interfaces.HAServiceKeyProvider
public void setHAPartition(org.jboss.ha.framework.interfaces.HAPartition partition)
HAServiceMBean
setHAPartition
in interface org.jboss.ha.framework.interfaces.HAService<Notification>
setHAPartition
in interface HAServiceMBean
partition
- the partitionpublic void setClusterPartition(ClusterPartitionMBean clusterPartition)
HAServiceMBean
setClusterPartition
in interface HAServiceMBean
clusterPartition
- the partitionpublic String getPartitionName()
HAServiceMBean
getPartitionName
in interface HAServiceMBean
public boolean isRegisterThreadContextClassLoader()
isRegisterThreadContextClassLoader
in interface org.jboss.ha.framework.interfaces.HAService<Notification>
public void setRegisterThreadContextClassLoader(boolean register)
setRegisterThreadContextClassLoader
in interface org.jboss.ha.framework.interfaces.HAService<Notification>
public String getHAServiceKey()
getHAServiceKey
in interface org.jboss.ha.framework.interfaces.HAServiceKeyProvider
public void setDistributedState(String key, Serializable value) throws Exception
setDistributedState
in interface HAServiceMBean
key
- key for the distributed objectvalue
- the distributed object
Exception
public Serializable getDistributedState(String key)
getDistributedState
in interface HAServiceMBean
key
- key for the distributed object
protected void createService() throws Exception
createService
in class ServiceMBeanSupport
Exception
ServiceMBeanSupport.createService()
protected void startService() throws Exception
Implementors of this method should not code the singleton logic here. The MBean lifecycle create/start/stop are separate from the singleton logic. Singleton logic should originate in becomeMaster().
Attention: Always call this method when you overwrite it in a subclass because it elects the master singleton node.
startService
in class ServiceMBeanSupport
Exception
protected void stopService() throws Exception
Attention: Always call this method when you overwrite it in a subclass
stopService
in class ServiceMBeanSupport
Exception
protected void destroyService() throws Exception
destroyService
in class ServiceMBeanSupport
Exception
ServiceMBeanSupport.destroyService()
protected void setupPartition() throws Exception
Exception
public List callMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
HAServiceMBean
callMethodOnPartition
in interface HAServiceMBean
args
- array of Java Object representing the set of parameters to be
given to the remote methodtypes
- The types of the parameters
Exception
protected void callAsyncMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
Exception
public boolean getSendLocalLifecycleNotifications()
Default is true
.
sendNotification(Notification)
public void setSendLocalLifecycleNotifications(boolean sendLocalLifecycleNotifications)
Default is true
.
sendNotification(Notification)
public boolean getSendRemoteLifecycleNotifications()
Default is true
.
See http://jira.jboss.com/jira/browse/JBAS-3194 for an example of a use case where this property should be set to false.
sendNotification(Notification)
public void setSendRemoteLifecycleNotifications(boolean sendRemoteLifecycleNotifications)
Default is true
.
See http://jira.jboss.com/jira/browse/JBAS-3194 for an example of a use case where this property should be set to false.
sendNotification(Notification)
public void sendNotification(Notification notification)
sendNotification
in interface HAServiceMBean
sendNotification
in class JBossNotificationBroadcasterSupport
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.getSendLocalLifecycleNotifications()
,
getSendRemoteLifecycleNotifications()
,
NotificationBroadcasterSupport.sendNotification(Notification)
,
JBossNotificationBroadcasterSupport.sendNotification(javax.management.Notification)
protected void sendNotificationRemote(Notification notification) throws Exception
notification
-
Exception
protected void sendNotificationToLocalListeners(Notification notification)
public void notifyListeners(Notification notification)
notifyListeners
in interface org.jboss.ha.framework.server.EventFacility<Notification>
EventFacility.notifyListeners(java.util.EventObject)
public void handleEvent(Notification notification) throws Exception
Exception
EventListener.handleEvent(java.util.EventObject)
public Notification createEvent(Object source, String type)
createEvent
in interface org.jboss.ha.framework.server.EventFactory<Notification>
EventFactory.createEvent(java.lang.Object, java.lang.String)
public String getServiceHAName()
getServiceHAName
in interface org.jboss.ha.framework.interfaces.HAService<Notification>
public void setServiceHAName(String haName)
setServiceHAName
in interface org.jboss.ha.framework.interfaces.HAService<Notification>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |