org.jboss.ha.framework.server.util
Class TopologyMonitorService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.ha.framework.server.util.TopologyMonitorService
All Implemented Interfaces:
HAPartition.AsynchHAMembershipListener (src) , HAPartition.HAMembershipListener (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src) , TopologyMonitorServiceMBean (src)

public class TopologyMonitorService
extends ServiceMBeanSupport (src)
implements TopologyMonitorServiceMBean (src) , HAPartition.AsynchHAMembershipListener (src)

A cluster parition membership monitor. It can be used to view how the nodes in a cluster are seeing the topology change using either email or a centralized log server. To use this to send email on change notifications use the following log4j.xml fragments: You can also have this service notify another MBean of the change to perform arbitrary checks by specifying the MBean name as the TriggerServiceName attribute value. This MBean must have an operation with the following signature:

   param: removed ArrayList of nodes that were removed
   param: added ArrayList of nodes that were added
   param: members ArrayList of nodes currently in the cluster
   param: logCategoryName the log4j category name used by the
      TopologyMonitorService. This should be used for logging to integrate with
      the TopologyMonitorService output.
   public void membershipChanged(ArrayList deadMembers, ArrayList newMembers,
      ArrayList allMembers, String logCategoryName)


Nested Class Summary
static class TopologyMonitorService.AddressPort (src)
           
 
Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
TopologyMonitorService()
           
 
Method Summary
 java.util.Vector getClusterNodes()
          Get the current cluster parition membership info
 java.lang.String getPartitionName()
          Get the cluster parition name the mbean is monitoring
 ObjectName (src) getTriggerServiceName()
          Get the trigger mbean to notify on cluster membership changes
 void membershipChanged(java.util.Vector deadMembers, java.util.Vector newMembers, java.util.Vector allMembers)
          Called when a new partition topology occurs.
 void setPartitionName(java.lang.String name)
          Set the cluster parition name the mbean is monitoring
 void setTriggerServiceName(ObjectName (src)  triggerServiceName)
          Set the trigger mbean to notify on cluster membership changes
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
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 (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
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 (src)
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Constructor Detail

TopologyMonitorService

public TopologyMonitorService()
Method Detail

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

getPartitionName

public java.lang.String getPartitionName()
Description copied from interface: TopologyMonitorServiceMBean (src)
Get the cluster parition name the mbean is monitoring

Specified by:
getPartitionName in interface TopologyMonitorServiceMBean (src)

setPartitionName

public void setPartitionName(java.lang.String name)
Description copied from interface: TopologyMonitorServiceMBean (src)
Set the cluster parition name the mbean is monitoring

Specified by:
setPartitionName in interface TopologyMonitorServiceMBean (src)

getTriggerServiceName

public ObjectName (src)  getTriggerServiceName()
Description copied from interface: TopologyMonitorServiceMBean (src)
Get the trigger mbean to notify on cluster membership changes

Specified by:
getTriggerServiceName in interface TopologyMonitorServiceMBean (src)

setTriggerServiceName

public void setTriggerServiceName(ObjectName (src)  triggerServiceName)
Description copied from interface: TopologyMonitorServiceMBean (src)
Set the trigger mbean to notify on cluster membership changes

Specified by:
setTriggerServiceName in interface TopologyMonitorServiceMBean (src)

getClusterNodes

public java.util.Vector getClusterNodes()
Description copied from interface: TopologyMonitorServiceMBean (src)
Get the current cluster parition membership info

Specified by:
getClusterNodes in interface TopologyMonitorServiceMBean (src)
Returns:
a Vector of org.jgroups.Address implementations, for example, org.jgroups.stack.IpAddress

membershipChanged

public void membershipChanged(java.util.Vector deadMembers,
                              java.util.Vector newMembers,
                              java.util.Vector allMembers)
Called when a new partition topology occurs.

Specified by:
membershipChanged in interface HAPartition.HAMembershipListener (src)
Parameters:
deadMembers - A list of nodes that have died since the previous view
newMembers - A list of nodes that have joined the partition since the previous view
allMembers - A list of nodes that built the current view