Hello,
In the last few days I have successfully instrumented one of my BluePrint
service. But I see a limitation.
Per JMX spec, *MBean Interface must be in the same package as the
Implementing MBean. But I want to keep the implementation packes internal
with the spirit of good BluePrint design. Hence what I see is the
limitation with the way JMXWhiteBoard bean is implemented.
So lets say I have the following two packages in my bundle.
*1. com.xxxx.jms.tester *- *For the service interface - This package is
exported*
It has the following interface!
package com.xxxx.jms.tester;
public interface SendMsgService{
public void sendMsg();
}
*2.com.xxxx.jms.intrenal.tester *- *For the service Impl (This package is
not exported)*
It has the following interface!
package com.xxxx.jms.tester.internal;
import com.xxxx.jms.tester.SendMsgService;
public interface *SendMsgMBean extends SendMsgService*{
}
And the following impl class:
package com.xxxx.jms.tester.internal;
import .....
public class *SendMsg implements SendMsgMBean*{
...
public void sendMsg() {
.............
}
}
*In my blueprint.xml I have for the bean impl!*
<bean id="sendMsgServiceBean"
class="com.xxxx.jms.tester.internal.SendMsg"
init-method="init" destroy-method="destroy">
<property name = "connectionFactory" ref="connectionFactory"/>
</bean>
*For the service and JMX white board*
<service id = "sendMsgService"
ref="sendMsgServiceBean" interface="*
com.xxxx.jms.tester.internal.SendMsgMBean*">
<service-properties>
<entry key="jmx.objectname" value="SendMsgMBean:name=sendMessage" />
</service-properties>
</service>
Everything works as expected!
*But in the spirit of a good design I would rather have the following xml
snippet:*
<service id = "sendMsgService"
ref="sendMsgServiceBean" interface="*com.xxxx.jms.tester.SendMsgService
*">
<service-properties>
<entry key="jmx.objectname" value="SendMsgMBean:name=sendMessage" />
</service-properties>
</service>
*Please note that SendMsgMBean extends SendMsgService. *
With this I get the benefit of both hiding my impl classes and interfaces
and also get the benifit of the JMXWhite board pattern. Before my OSGi
days, this is the approach I took in keeping interface/impl separate.
But with this approach, I do get the JMX instrumentation! It does not work!
I think it is a limitation. Please correct me if I'm wrong!
Can some one please review this and answer me ? I'm really curious.
I really think JMX white board is a good pattern, hence my curiosity!
Thanks in advance!
Matt