站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 cluster API Documentation 英文版文档

HAServiceMBeanSupport (JBoss Cluster API) - JBoss 4.0.1 sp1 cluster API Documentation 英文版文档


org.jboss.ha.jmx
Class HAServiceMBeanSupport

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.ha.jmx.HAServiceMBeanSupport
All Implemented Interfaces:
HAServiceMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean
Direct Known Subclasses:
HAILSharedState, HASingletonSupport

public class HAServiceMBeanSupport
extends org.jboss.system.ServiceMBeanSupport
implements HAServiceMBean

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.

Version:
$Revision: 1.6 $
Author:
Ivelin Ivanov *

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

HAServiceMBeanSupport

public HAServiceMBeanSupport()
Method Detail

getPartitionName

public String getPartitionName()
Description copied from interface: HAServiceMBean
Name of the underlying partition that determine the cluster to use.

Specified by:
getPartitionName in interface HAServiceMBean

setPartitionName

public void setPartitionName(String newPartitionName)
Description copied from interface: HAServiceMBean
Set the name of the underlying partition that determine the cluster to use. Can be set only when the MBean is not in a STARTED or STARTING state.

Specified by:
setPartitionName in interface HAServiceMBean

setDistributedState

public void setDistributedState(String key,
                                Serializable value)
                         throws Exception
Convenience method for sharing state across a cluster partition. Delegates to the DistributedStateService

Specified by:
setDistributedState in interface HAServiceMBean
Parameters:
key - key for the distributed object
value - the distributed object
Throws:
Exception

getDistributedState

public Serializable getDistributedState(String key)
Convenience method for sharing state across a cluster partition. Delegates to the DistributedStateService

Specified by:
getDistributedState in interface HAServiceMBean
Parameters:
key - key for the distributed object
Returns:
Serializable the distributed object

startService

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.

Throws:
Exception

stopService

protected void stopService()
                    throws Exception

Attention: Always call this method when you overwrite it in a subclass

Throws:
Exception

setupPartition

protected void setupPartition()
                       throws Exception
Throws:
Exception

registerRPCHandler

protected void registerRPCHandler()

unregisterRPCHandler

protected void unregisterRPCHandler()

registerDRMListener

protected void registerDRMListener()
                            throws Exception
Throws:
Exception

unregisterDRMListener

protected void unregisterDRMListener()
                              throws Exception
Throws:
Exception

partitionTopologyChanged

public void partitionTopologyChanged(List newReplicants,
                                     int newReplicantsViewId)

isDRMMasterReplica

protected boolean isDRMMasterReplica()

getPartition

public HAPartition getPartition()

callMethodOnPartition

public void callMethodOnPartition(String methodName,
                                  Object[] args)
                           throws Exception
Deprecated. Use callMethodOnPartition(String, Object[], Class[]) instead

Description copied from interface: HAServiceMBean
Convenience method for broadcasting a call to all members of a partition.

Specified by:
callMethodOnPartition in interface HAServiceMBean
Parameters:
methodName -
args -
Throws:
Exception

callMethodOnPartition

public void callMethodOnPartition(String methodName,
                                  Object[] args,
                                  Class[] types)
                           throws Exception
Throws:
Exception

sendNotification

public 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.

Specified by:
sendNotification in interface HAServiceMBean
Parameters:
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.
See Also:
NotificationBroadcasterSupport.sendNotification(Notification)

sendNotificationToLocalListeners

protected void sendNotificationToLocalListeners(javax.management.Notification notification)

callAsyncMethodOnPartition

protected void callAsyncMethodOnPartition(String methodName,
                                          Object[] args,
                                          Class[] types)
                                   throws Exception
Throws:
Exception

sendNotificationRemote

protected void sendNotificationRemote(javax.management.Notification notification)
                               throws Exception
Broadcast a notifcation remotely to the partition participants

Parameters:
notification -
Throws:
Exception

_receiveRemoteNotification

public void _receiveRemoteNotification(javax.management.Notification notification)
Invoked by remote broadcasters. Delegates to the super class


getServiceHAName

public String getServiceHAName()
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.

Returns:
partition wide unique service name

findHAPartitionWithName

protected HAPartition findHAPartitionWithName(String name)
                                       throws Exception
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.