public class HAServiceMBeanSupport extends ServiceMBeanSupport implements HAServiceMBean(Code)
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.
author: Ivelin Ivanov * version: $Revision: 57188 $
getSendLocalLifecycleNotifications() Gets whether JMX Notifications should be sent to local (same JVM) listeners
if the notification is for an attribute change to attribute "State".
public boolean
getSendRemoteLifecycleNotifications() Gets whether JMX Notifications should be sent to remote listeners
if the notification is for an attribute change to attribute "State".
sendNotification(Notification notification) Broadcast the notification to the remote listener nodes (if any) and then
invoke super.sendNotification() to notify local listeners.
Parameters: notification - sent out to local listeners and other nodes.
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".
public 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".
Convenience method for sharing state across a cluster partition.
Delegates to the DistributedStateService
Parameters: key - key for the distributed object Serializable the distributed object
Override this method only if you need to provide a custom partition wide unique service name.
The default implementation will usually work, provided that
the getServiceName() method returns a unique canonical MBean name.
partition wide unique service name
Convenience method for sharing state across a cluster partition.
Delegates to the DistributedStateService
Parameters: key - key for the distributed object Parameters: value - the distributed object
setPartitionName
public void setPartitionName(String newPartitionName)(Code)
setSendLocalLifecycleNotifications
public void setSendLocalLifecycleNotifications(boolean sendLocalLifecycleNotifications)(Code)
Sets whether JMX Notifications should be sent to local (same JVM) listeners
if the notification is for an attribute change to attribute "State".
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.