Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Today creating a Standard MBean means writing an interface that defines the management interface, and a class that implements that interface. This could be made simpler using annotations. In the simplest case, you could eliminate the interface and instead add a @Management annotation to each public method that is part of the management interface. @MBean public class MyResource { @Management public int getCacheSize() {...} @Management public void setCacheSize(int x) {...} ...other stuff unrelated to management... } You could also use annotations to control what the name of the MBean is, for example by saying that its name is derived from the values of the Foo and Bar attributes. @MBean(type = "MyResource") public class MyResource { @MBeanNameKey("foo") public String getFoo() {...} @MBeanNameKey("bar") public int getBar() {...} } Although there are some tricky implementation questions, it would be great if you could tag a private field as being an attribute: public class MyResource { @MBeanAttribute("RequestCount") private int requestCount; public Result request(...) { requestCount++; ... } }
|