• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JMX basic question  RSS feed

 
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
 
Rancher
Posts: 42974
76
  • 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 !
 
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!