File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Understanding JMX

 
Nirav A Mehta
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I have a problem understanding JMX. Suppose I have an aplication which I want to make manageable using JMX. So I create an MBean with the properties. Do I then explicitly have to run a separate program that will register it? Sound a little silly, cause if I have a web application, then how do I register and initialize this mbean as part of it? It will happen everytime a user calls for the application. The application is meant to be the client to the MBean. Since it should be a deployable application, how do I make the MBean register just once everytime the web server starts?

Nirav
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well as an example in JBoss. you would just archive the file into a .sar and drop it into the JBoss deploy directly and the MBean will run.

Mark
 
Nirav A Mehta
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just one more doubt. As far as the picking up configurable properties goes, what would be the difference between an MBean and a Entity bean with BMP? Because anyways, the configured values will have to be persisted somewhere so that each time the server restarts, the values can be retained.

Please clarify this for me. I know I have to be wrong, since JMX is such a popular choice for application management.

Nirav
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MBeans are supposed to reflect and influence the state of whatever application they're used with - an app server in this case. It's not the responsibility of JMX to save and restore any state, it's the responsibility of the application to do that, and the MBeans will merely reflect the state of the app. If you find yourself considering adding persistence features to MBeans, you might be misusing JMX.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I wouldn't even compare MBeans to any EJB Beans. It is like comparing a JTextField in Swing with an Message Driven Bean, they are just really unrelated, so to speak.

Mark
 
Nirav A Mehta
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
MBeans are supposed to reflect and influence the state of whatever application they're used with - an app server in this case. It's not the responsibility of JMX to save and restore any state, it's the responsibility of the application to do that, and the MBeans will merely reflect the state of the app.


Then is there a way to automatically persist some configured properties. A very common example of using JMX is to specify logging properties for an application. Suppose I change the logging properties. I dont want to lose the values when my server is restarted. I want to retain them with some kind of persistance mechanism. Can this be done? If not automatically, MBeans should have a lifecycle implementation to allow such a thing.
I was just going through Geronimo's implementation of GBeans which is sort of an extension of MBeans which kinda solves all issues that a deployable application should have. Maybe JMX can provide a similar support to make it a standard.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then is there a way to automatically persist some configured properties.


Persisting anything is not part of JMX. If the changes made to an applications configuration through JMX are supposed to be permanent, then the application should store those settings somewhere. You can of course put the persistence code in the MBeans, but JMX is not going to help you with that.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic