• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMX basic question  RSS feed

 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to JMX, and would appreciate advise on the following question:

Suppose you expose some class as an MBean . E.g, you have MyConnectionPool which is an MBean (implementing interface MyConnectionPoolMBean, and registered on an mbean server).

Is it accepptable to allow local classes (in the same JVM) to directly access methods of my MyConnectionPool , *wihtout* going through the mbean Server ?

Example:

MyConnectionPool pool=new MyConnectionPool();
MBeanServer server = MBeanServerFactory.createMBeanServer();
server.registerMBean(pool, someObjectName);
pool.getConnection(..); // is this ok ?
pool.setMaxLimie(6); // is this ok ?

The last 2 lines do direct access to the Pool mbean, not going through the mbean server...
I mentioned those 2 different line, because
- the first line calls a method that probably isn't exposed through the JMX interface of the pool (getConnection is not a management method... and connection is not even serializable...).
- the second line calls a method that' probably exposed through the JMX interface of the pool (setting a limit is indeed a management method).

Are both these lines acceptable ?
And will it work for all types of beans (even, say, Model bean) ?

Thanx
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that it would be the exception that all methods are exposed through the MBean, so calling methods that are not part of the interface is OK.

The second case is also OK. Just take care that the new status is properly reflected through the MBean interface.
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much !
 
Tamilselvan Guru
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Test
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!