Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

notification in JMx

 
vinayaga moorthi
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
how to write the notification and listner class for the JMX.

vinayagamoorthi
 
Henry Wong
author
Marshal
Pie
Posts: 21506
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vinayaga moorthi:
Hi,
how to write the notification and listner class for the JMX.

vinayagamoorthi


JMX notifications is not something that you can learn in a few paragraphs, I would suggest that you pick up a good book on JMX... but I can try...

Your mbean needs to implement the NotificationBroadcaster interface (with JMX 1.2, you could also use the NotificationEmitter interface instead). One of the methods of this interface, is the add listener, which allows you to add a listener. Basically, this method should just add the notification listeners being registered in some container in the mbean.

When your mbean needs to send a notification, it should create a notification object, iterate through the container of listeners, and call the listeners handle notification method. You also need to give the hand back object back, so that the listeners will have some idea of context.

For the mbean, that is all you need to do... well, except maybe decide which notification you want to send, and how to configure it.


On the client side, you need to develop a notification listener, which is basically a class with a single handle listener method. Either get a context to the mbean server directly, or via an mbean server connector, and call the add notification listener method, to register the listener to a particular mbean.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic