-
Enhancement
-
Resolution: Fixed
-
P4
-
6
-
b32
-
generic
-
generic
-
Verified
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++;
...
}
}
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++;
...
}
}
- duplicates
-
JDK-4853303 Annotations to define MBean*Info descriptions and MBeanOperationInfo impact
- Closed
- relates to
-
JDK-6774918 @NotificationInfo is ineffective on MBeans that cannot send notifications
- Closed
-
JDK-5072268 Suggested API changes for JMX 2.0
- Closed
-
JDK-6675526 Define an Annotation to name registered MBeans
- Closed