Open glassfishrobot opened 11 years ago
Reported by rherschke
@bshannon said: For some time I've hoped that we would more fully define the use of JMX in Java EE applications. Sadly, it hasn't been a priority. Defining access to an MBeanServer is just a part of it.
This is something we should consider to consider in future releases, but without significant customer feedback that this is important it's unlikely this will be addressed anytime soon.
This issue was imported from java.net JIRA JAVAEE_SPEC-21
My proposal is to specify in EE 7 that MBeanServer injection should be able in a container environment.
The reason for this proposal is, that some AS provide it's own platform specific MBeanServer, so that ManagementFactory.getPlatformMBeanServer() will not provide the correct MBeanServer.
To build platform independent components, the container should provide the correct MBeanServer via @Resource or @Inject.
With this, one for example can implement an interceptor with @AroundConstruct to do the registration of a MXBean in a container environment.
This would pass the rule of separating concerns and will get a clear EJB Pojo as well.
Example:
So with @Resource injection, this will work even on appservers with its own MBeanServer, not only with JVM PlatformServer, but the developer do not care about this.
Next, @Resource injection could be used also in a normal EJB to do some client work (observe notifications, get attributes aso.) with a registered mbean without the need to distinguish about the right MBeanServer to be used.