Bug 265540 - JMX: Add runtime services MBean monitoring to Java SE clients
Summary: JMX: Add runtime services MBean monitoring to Java SE clients
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL: http://wiki.eclipse.org/EclipseLink/E...
Whiteboard:
Keywords:
Depends on: 332312 248748 316513
Blocks: 238412 320431
  Show dependency tree
 
Reported: 2009-02-19 15:19 EST by Michael OBrien CLA
Modified: 2022-06-09 10:19 EDT (History)
2 users (show)

See Also:
michael.f.obrien: documentation+


Attachments
Prototype Java SE JMX Runtime Services MBean in JConsole (171.29 KB, image/pjpeg)
2009-02-19 15:21 EST, Michael OBrien CLA
no flags Details
Very rough proof of concept prototype for Java SE MBeans (30.66 KB, text/plain)
2009-02-20 13:59 EST, Michael OBrien CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael OBrien CLA 2009-02-19 15:19:46 EST
This enhancement request is for JPA SE clients (not running on an application server) that wish to have runtime services JMX MBeans enabled and available via standard SE JConsole.

Constraints:
-----------

1) How to register MBeans in Java SE?
On the server we use a JNDI lookup to find the servers' implementation of MBeanServer - we don't have JNDI out of the box in SE.
In SE we use the JMX bootstrap class and call ManagementFactory.getPlatformMBeanServer(); to get the MBeanServer.
We then do the same type of registerMBean(mbean, name) call.

2) Subclass NoServerPlatform, CustomServerPlatform or a new platform off of the abstract ServerPlatformBase?
I think we are ok expanding NoServerPlatform - see 3 and 4
After a discussion with Tom.

3) Code must be Java 5 compatible - yes (MBeanServer and ManagementFactory) have been in the JRE since 1.5
http://java.sun.com/j2se/1.5.0/docs/guide/management/mxbeans.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html

4) Are we ok placing the SE functionality in NoServerPlatform as opposed to creating a configurable Java_SE_Platform subclass - yes
The NoServerPlatform implementation is the default platform for all other platforms in the DatabaseSessionImpl constructor, later the actual platform for the server or NoServerPlatform in the case of an SE application is instantiated second.  Therefore as long as any extended functionality is outside the constructor and static methods we are ok.

5) By default would any JMX functionality be instantiated out of the box?
No, the user will need to run with the following flags set, one to enable visibility in JConsole and the other to enable MBean registration/unregistration as well as optional orm properties.

-Dcom.sun.management.jmxremote 
-Declipselink.register.run.mbean=true

Prototype:
----------
See the attached screencapture of a prototype Java SE registration of the runtime services mbean for the SE DDL generation example app used to populate the database for the server example at...

http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen/src/org/eclipse/persistence/example/jpa/server/common/DDLGenerationClient.java

If you put a breakpoint anywhere in generateGlider() so that the SE process holds the JVM up in eclipse after platform registration - you will see the mbean for the session by running JConsole on this process.

See related work in bug# 248748
Comment 1 Michael OBrien CLA 2009-02-19 15:21:12 EST
Created attachment 126211 [details]
Prototype Java SE JMX Runtime Services MBean in JConsole
Comment 2 Michael OBrien CLA 2009-02-19 15:23:19 EST
>For constraint 1
Details on Java SE MBeanServer creation via bootstrap ManagementFactory
http://java.sun.com/javase/6/docs/technotes/guides/jmx/tutorial/essential.html#wp1054889
See JEE to JSE migration issues
http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/jmx-1.2-errata.jsp
Comment 3 Michael OBrien CLA 2009-02-20 13:59:50 EST
Created attachment 126336 [details]
Very rough proof of concept prototype for Java SE MBeans

This version of NoServerPlatform.java needs to have it's own version of the runtime server MBean, for now I have use the MBean instantiated by WebLogic.
The code needs a full cleanup and removal of any weblogic imports.

Currently if you drop in this code and configure your JVM for remote MBeans you will see MBeans on your sessions while you are running or if the JVM is halted in debug mode.

When we require this change in the future - this prototype will be fully reworked and/or discarded.
Comment 4 Michael OBrien CLA 2010-07-19 09:23:58 EDT
>Requested as well by PMO and the user vote above
>now that the JMX MBean API has been moved up into JMXServerPlatformBase - we can revisit SE JMX support
- we will likely make NoServerPlatform subclass the new JMX abstract class and implement JMXEnabledPlatform
- this work should commence once bug# 316513 is fully implemented
- as of SVN rev# 7777 the infrastructure is in place
Comment 5 Michael OBrien CLA 2010-07-28 10:42:46 EDT
>Upping priority to P2 - I would like to get this done just after 2.1.1 since the EE server refactor is now complete
Comment 6 Peter Krogh CLA 2010-11-10 11:06:49 EST
Deferring to Future, as part of 2.2 bug scrub.
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:19:26 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink