The built-in JMX browser of jonasAdmin invokes mbean methods twice
Using the built-in JMX browser of jonasAdmin invokes mbean methods twice. This lead to misbehaviour of components managed by this way.
workarround:
- use OW2/JASMINE mbeancmd, jconsole or jvisualvm instead of the built-in JMX browser, to invoke method.
- use the built-in JMX browser for read only operations.
Matter of facts:
I access a mbean registered in the JOnAS mbean server by an OSGi bundle. The ObjectName is: energetic:type=case,name=dupplicateInvoke
It contains a method aMethod(), and an attribute MethodInvokeCount, that counts thenumbr of times the method has been invoked.
If from jconsole : I read the attribute, then invoke aMethod(), then re-read the attribute, I get the following log traces:
2012-01-30 07:11:53,176 : INFO : RMI TCP Connection(6)-192.168.1.69 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 0. 2012-01-30 07:12:13,561 : INFO : RMI TCP Connection(9)-192.168.1.69 : DupInvokeCase.aMethod : INVOKE aMethod() - counter: 1. 2012-01-30 07:12:36,974 : INFO : RMI TCP Connection(9)-192.168.1.69 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 1.
If then I use the buil-in jmx browser of the jonasAdmin Web console.
a) Navigating to the mbean node, then selecting it, I get:
2012-01-30 07:13:54,167 : INFO : http-bio-8984-exec-5 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 1. 2012-01-30 07:13:54,174 : INFO : http-bio-8984-exec-5 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 1. The attribute is read twice ! b) If then I invoke aMethod(), I get :
2012-01-30 07:14:12,217 : INFO : http-bio-8984-exec-2 : DupInvokeCase.aMethod : INVOKE aMethod() - counter: 2. 2012-01-30 07:14:12,224 : INFO : http-bio-8984-exec-2 : DupInvokeCase.aMethod : INVOKE aMethod() - counter: 3. 2012-01-30 07:14:12,292 : INFO : http-bio-8984-exec-1 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 3. 2012-01-30 07:14:12,304 : INFO : http-bio-8984-exec-1 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 3. 2012-01-30 07:14:12,311 : INFO : http-bio-8984-exec-1 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 3. 2012-01-30 07:14:12,320 : INFO : http-bio-8984-exec-1 : DupInvokeCase.getMethodInvokeCount : COUNT - invokation(s): 3. The method aMethod() is called twice, the attribute is called four times !
Hereafter in attachment, the test case bundle.