Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Created config dynamic MBean interface #107
please have a look on those changes. It adds a new Interface JMXBean (maybe change to according naming pattern) which allows to dynamicly register a config class to a running mbean service (necessary methods added to PropertiesManager).
I was not sure if further checking for Accessible, Mutable and Reloadable is necessary in PropertiesManager (so I guess Mbean now could write on mutable config object).
Maybe take a look at the changes and revise if necessary. I would find a jmx accessibele config very useful. MBeans are accessible in jvm through jconsole.
Thanks for your time!
I'm not an expert on JMX, so I need to study it a little bit more before accepting your code. I've used JMX once and I don't remember that I needed to implement DynamicMBean. I just needed to implement an interface ending with name MBean (i.e. ConfigMBean) then expose it through the MBeanServer. So I am a bit confused that all this code is needed.
I'm not sure that OWNER library works fine in android, but it should. importing javax.management could preclude android support. Possibly we can have jmx support without importing any javax.management class (?), it should be possible.
Ok that is a fair point, I did not thought of Android so far, sorry. For backend guys JMX is a real valuable monitoring feature but of course it should not break an android development branch.
The interface naming you mentioned maybe only works with non-proxy objects, I did not got it working with the normal interfaces (even with Naming ended with MBean). I tried that first. Maybe you have better luck:
Failed while registering MBean, Bean not compliant: javax.management.NotCompliantMBeanException: MBean class PackageXYZ.$Proxy6 does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class PackageXYZ.$Proxy6 is not a JMX compliant Standard MBean) nor the MXBean conventions javax.management.NotCompliantMBeanException:
Of course take the time you need to think about my proposals. I have no hurry with this but would find it very useful feature.
That would be really cool!
In the mean time I could prepare some more interface checks with operation invocation and setAttribute(s) methods. At the moment it is still possible to change properties of immutable configs or reload non-reloadable configs.
If you have a better idea of adding DynamicMBean interface just refactore it. I thought it might fit there but of course I am not very familiar with your code structure, yet.
Rebased on master branch. Thanks.
This feature will be released with next public release.
I did some refactoring and also changed the way it works. Now, when jmx invocation changes the configuration, events are triggered, and thread synchronization is implemented properly.
There is no need to implement any specific class,
Also I thought to expose setProperty/getProperty/reload() independently from the fact that the class to instantiate implements Accessible/Mutable/Reloadable.
Most of the code you committed has been moved in class
I also implemented an example class, that will be useful to write some documentation later. See
Thanks for your contribution.