Methods Summary |
---|
protected void | addHANotificationListener(javax.management.NotificationListener listener)
server.addNotificationListener(broadcasterName_, listener,
/* no need for filter */ null,
/* no handback object */ null);
|
public java.lang.String | getHANotificationBroadcasterName()
return broadcasterName_ == null ? null : broadcasterName_.toString();
|
public java.util.Collection | getReceivedNotifications()Lists the notifications received on the cluster partition
return messages_;
|
public void | handleNotification(javax.management.Notification notification, java.lang.Object handback)
messages_.add(notification.getMessage());
|
protected void | removeHANotificationListener(javax.management.NotificationListener listener)
server.removeNotificationListener(broadcasterName_, listener);
|
public void | sendTextMessageViaHANBExample(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);
server.invoke(
broadcasterName_,
"sendNotification",
new Object[] { notification },
new String[] { Notification.class.getName() }
);
|
public void | setHANotificationBroadcasterName(java.lang.String newBroadcasterName)Sets the name of the broadcaster MBean.
if (newBroadcasterName == null)
{
throw new InvalidParameterException("Broadcaster MBean must be specified");
}
try
{
broadcasterName_ = new ObjectName(newBroadcasterName);
}
catch (MalformedObjectNameException mone)
{
log.error("Broadcaster MBean Object Name is malformed", mone);
throw new InvalidParameterException("Broadcaster MBean is not correctly formatted");
}
|
protected void | startService()On service start, subscribes to notification sent by this broadcaster or its remote peers.
super.startService();
addHANotificationListener(this);
|
protected void | stopService()On service stop, unsubscribes to notification sent by this broadcaster or its remote peers.
removeHANotificationListener(this);
super.stopService();
|