[jboss-user] [Management, JMX/JBoss] - Re: jboss JMX notification type
leonz11
do-not-reply at jboss.com
Fri Apr 20 07:07:11 EDT 2007
thanx, dimitris.
I tried to subscribe the "org.jboss.system.server.stopped" in a simple MBean as the following sample code; but could not get this event notification when I shut down the server with control-C on windows.
--------------------------------------------------------
package notificationMbean;
import javax.management.Notification;
import javax.management.ObjectName;
import org.jboss.system.ListenerServiceMBeanSupport;
public class NotificationListener
extends ListenerServiceMBeanSupport
implements NotificationListenerMBean
{
// Constructors --------------------------------------------------
/**
* CTOR
**/
public NotificationListener()
{
// empty
}
// NotificationListenerMBean implementation ----------------------
// No attributes or operations in this example to implement!
// Lifecycle control (ServiceMBeanSupport) -----------------------
/**
* Start
**/
public void startService()
throws Exception
{
// subscribe for notification, true=dynamic
super.subscribe(true); // listener is me!
}
/**
* Stop
**/
public void stopService()
throws Exception
{
// unsubscribe for notifications
super.unsubscribe();
}
// ListenerServiceMBeanSupport override ------------------------
/**
* Overriden to add handling!
**/
public void handleNotification2(Notification notification, Object handback)
{
System.out.println("Got notification2: " + notification + ", handback: " + handback);
}
public void handleNotification(Notification notification, Object handback)
{
System.out.println("Got notification1: " + notification + ", handback: " + handback);
}
}
-----------------------------------------
service xml
-----------------------------------------
<subscription-list>
</subscription-list>
-------------------------------------------
can you see why I could not get the notification?
Thanx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039217#4039217
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039217
More information about the jboss-user
mailing list