JMX : getter with parameter on dynamic mbeans

Hi,

I have a getter with a parameter on my mbean (dynamic)

(ex getPoolSizeForConnextion (String connexionId)).

In first, I thinks to use the invoke method in dynamic Mbeans, but in the sun specification for JMX 1.2 it s written : "it is forbidden in 1.2", what is the best way to use when getter has parameter?

Thanks

(sorry for my english)

From spec JCM 1.2 page 42 (bottom) :

In the JMX 1.2 specification, it is forbidden to call getters and setters via invoke.

Previously, an implementation was free to choose whether or not to allow this.

However, if the property jmx.invoke.getters does not have an empty value, the

code forbidding calling getters and setters through invoke is disabled

[758 byte] By [jadtna] at [2007-10-3 4:11:46]
# 1

A getter by definition has no parameters. If your method is getPoolSizeForConnection(String id), then it is an operation, even though its name begins with "get". So it must be invoked with MBeanServer.invoke.

The question of getters only arises for Standard MBeans. In Dynamic MBeans, you control the logic for getAttribute and for invoke, so you get to decide what methods they call. You don't have to follow the getter/setter convention, though nothing prevents you from doing so.

The text you quote was confusing; see <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4949203>. It has been removed from the latest version of the specification, available at <http://download.java.net/jdk6/docs/technotes/guides/jmx/JMX_1_4_specification.pdf>.

emcmanusa at 2007-7-14 22:12:25 > top of Java-index,Core,Monitoring & Management...