FileDocCategorySizeDatePackage
HANotificationBroadcasterExample.javaAPI DocJBoss 4.2.13206Fri Jul 13 20:52:42 BST 2007org.jboss.ha.jmx.examples

HANotificationBroadcasterExample

public class HANotificationBroadcasterExample extends org.jboss.ha.jmx.HAServiceMBeanSupport implements HANotificationBroadcasterExampleMBean
This MBean is an example showing how to extend a cluster notification broadcaster Use the sendNotiication() operation to trigger new clustered notifications. Observe the status of each instance of this mbean in the participating cluster partition nodes.
author
Ivelin Ivanov

Fields Summary
Collection
messages_
NotificationListener
listener_
Constructors Summary
Methods Summary
public java.util.CollectiongetReceivedNotifications()
Lists the notifications received on the cluster partition

    return messages_;
  
public voidsendTextMessage(java.lang.String message)
Broadcasts a notification to the cluster partition. This example does not ensure that a notification sequence number is unique throughout the partition.

    long now = System.currentTimeMillis();
    Notification notification =  
      new Notification("hanotification.example.counter", super.getServiceName(), now, now, message);
    sendNotification(notification);
  
protected voidstartService()
On service start, subscribes to notification sent by this broadcaster or its remote peers.

    super.startService();
    addNotificationListener(listener_, /* no need for filter */ null, /* no handback object */ null);
  
protected voidstopService()
On service stop, unsubscribes to notification sent by this broadcaster or its remote peers.

    removeNotificationListener(listener_);
    super.stopService();