ehcache / ehcache-jcache

The Ehcache 2.x implementation of JSR107 (JCACHE)
Other
91 stars 48 forks source link

JCacheManager.enableManagement spec violation #21

Closed Mobe91 closed 10 years ago

Mobe91 commented 10 years ago

The spec says: "The platform MBeanServer is obtained using ManagementFactory.getPlatformMBeanServer()"

but the current enableManagement implementation uses registerObject which is implemented as follows

private void registerObject(final JCacheMXBean cacheMXBean) throws NotCompliantMBeanException,
        InstanceAlreadyExistsException, MBeanRegistrationException, MalformedObjectNameException {
        final ObjectName objectName = new ObjectName(cacheMXBean.getObjectName());
        if(mBeanServer.queryNames(objectName, null).isEmpty()) {
            mBeanServer.registerMBean(cacheMXBean, objectName);
        }
    }

mBeanServer is a newly created MBeanServer and is not obtained using ManagementFactory.getPlatformMBeanServer().

alexsnaps commented 10 years ago

We should make this configurable. Probably defaulting to the platform MBeanServer indeed. It should be configurable because of how the TCK wants to test for this. Probably should try to get rid of the tck package from within the implementation as well.

alexsnaps commented 10 years ago

Started a thread on the subject on our dev-mailing list https://groups.google.com/forum/#!topic/ehcache-dev/rCvdLPBzYFw Not quite sure how we best fix this...