|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport org.jboss.ha.jmx.HAServiceMBeanSupport
Management Bean for an HA-Service. Provides a convenient common base for cluster symmetric MBeans. This class is also a user transparent extension of the standard NotificationBroadcasterSupport to a clustered environment. Listeners register with their local broadcaster. Invoking sendNotification() on any broadcaster, will notify all listeners in the same cluster partition. TODO: The performance can be further optimized by avoiding broadcast messages when remote listener nodes are not interested (e.g. have no local subscribers) or by iterating locally over filters or remote listeners.
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 | |
HAServiceMBeanSupport()
|
Method Summary | |
void |
_receiveRemoteNotification(javax.management.Notification notification)
Invoked by remote broadcasters. |
protected void |
callAsyncMethodOnPartition(String methodName,
Object[] args,
Class[] types)
|
void |
callMethodOnPartition(String methodName,
Object[] args)
Convenience method for broadcasting a call to all members of a partition. |
void |
callMethodOnPartition(String methodName,
Object[] args,
Class[] types)
|
protected HAPartition |
findHAPartitionWithName(String name)
|
Serializable |
getDistributedState(String key)
Convenience method for sharing state across a cluster partition. |
HAPartition |
getPartition()
|
String |
getPartitionName()
Name of the underlying partition that determine the cluster to use. |
String |
getServiceHAName()
Override this method only if you need to provide a custom partition wide unique service name. |
protected boolean |
isDRMMasterReplica()
|
void |
partitionTopologyChanged(List newReplicants,
int newReplicantsViewId)
|
protected void |
registerDRMListener()
|
protected void |
registerRPCHandler()
|
void |
sendNotification(javax.management.Notification notification)
Broadcast the notification to the remote listener nodes (if any) and then invoke super.sendNotification() to notify local listeners. |
protected void |
sendNotificationRemote(javax.management.Notification notification)
Broadcast a notifcation remotely to the partition participants |
protected void |
sendNotificationToLocalListeners(javax.management.Notification notification)
|
void |
setDistributedState(String key,
Serializable value)
Convenience method for sharing state across a cluster partition. |
void |
setPartitionName(String newPartitionName)
Set the name of the underlying partition that determine the cluster to use. |
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 |
protected void |
unregisterDRMListener()
|
protected void |
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.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 |
public HAServiceMBeanSupport()
Method Detail |
public String getPartitionName()
HAServiceMBean
getPartitionName
in interface HAServiceMBean
public void setPartitionName(String newPartitionName)
HAServiceMBean
setPartitionName
in interface HAServiceMBean
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 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.
Exception
protected void stopService() throws Exception
Attention: Always call this method when you overwrite it in a subclass
Exception
protected void setupPartition() throws Exception
Exception
protected void registerRPCHandler()
protected void unregisterRPCHandler()
protected void registerDRMListener() throws Exception
Exception
protected void unregisterDRMListener() throws Exception
Exception
public void partitionTopologyChanged(List newReplicants, int newReplicantsViewId)
protected boolean isDRMMasterReplica()
public HAPartition getPartition()
public void callMethodOnPartition(String methodName, Object[] args) throws Exception
callMethodOnPartition(String, Object[], Class[])
instead
HAServiceMBean
callMethodOnPartition
in interface HAServiceMBean
methodName
- args
-
Exception
public void callMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
Exception
public void sendNotification(javax.management.Notification notification)
sendNotification
in interface HAServiceMBean
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.NotificationBroadcasterSupport.sendNotification(Notification)
protected void sendNotificationToLocalListeners(javax.management.Notification notification)
protected void callAsyncMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
Exception
protected void sendNotificationRemote(javax.management.Notification notification) throws Exception
notification
-
Exception
public void _receiveRemoteNotification(javax.management.Notification notification)
public String getServiceHAName()
protected HAPartition findHAPartitionWithName(String name) throws Exception
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |