[JAVA-666] Don't rely on MXBean Created: 12/Oct/12  Updated: 08/Jan/13  Resolved: 22/Oct/12

Status: Closed
Project: Java Driver
Component/s: API, Monitoring
Affects Version/s: 2.9.0
Fix Version/s: 2.9.2, 2.10.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to JAVA-641 JMX registration error Closed

 Description   

The driver recently switched to using MXBean, which doesn't work on Java 5. This was unintentional and should be reverted.



 Comments   
Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-19T14:00:09Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/2ee8c205515c4bec7c166ac1c13ab8c3ba220ac4

Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-19T14:00:09Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: 2.10.x
https://github.com/mongodb/mongo-java-driver/commit/2ee8c205515c4bec7c166ac1c13ab8c3ba220ac4

Comment by auto [ 22/Oct/12 ]

Author:

{u'date': u'2012-10-19T07:00:09-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/a215bdf4101033aac08aa72768a4bbe417e83402

Comment by auto [ 20/Oct/12 ]

Author:

{u'date': u'2012-10-19T07:00:09-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: release-2.9.x
https://github.com/mongodb/mongo-java-driver/commit/2ee8c205515c4bec7c166ac1c13ab8c3ba220ac4

Comment by Jeffrey Yemin [ 20/Oct/12 ]

I have a fix for this that I think will work: DBPortPool will no longer be either an MBean or an MXBean. Instead, there will be two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former will be an MXBean and the latter an MBean. At run-time, the driver will detect the Java version (java.version system property) and instantiate a Java5MongoConnectionPool if it's 1.5 and MongoConnectionPool otherwise. I'll also make sure that the MBean/MXBean interfaces have names that match the classes that implement them: MongoConnectionPoolMXBean and Java5MongoConnectionPoolMBean, respectively. This should take care of the Resin/JBoss issues reported on JAVA-641.

Comment by Mark Cohen [ 16/Oct/12 ]

We're having the problem from JAVA-641 using JDK 1.6.0_21 as an FYI.

Generated at Thu Feb 08 08:52:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.