dlmarion commented on code in PR #33:
URL:
https://github.com/apache/accumulo-classloaders/pull/33#discussion_r2694583141
##########
modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/LocalCachingContextClassLoaderFactory.java:
##########
@@ -196,6 +205,16 @@ public void init(ContextClassLoaderEnvironment env) {
} catch (IOException | ContextClassLoaderException e) {
throw new IllegalStateException("Error creating base cache directory at
" + baseCacheDir, e);
}
+ try {
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ mbs.registerMBean(new ContextClassLoaders(),
ContextClassLoadersMXBean.getObjectName());
+ } catch (MalformedObjectNameException | MBeanRegistrationException
+ | NotCompliantMBeanException e) {
+ throw new IllegalStateException("Error registering MBean", e);
+ } catch (InstanceAlreadyExistsException e) {
+ // instance was re-init'd. This is likely to happen during tests
+ // can ignore as no issue here
+ }
Review Comment:
This registers the ContextClassLoadersMXBean with the JMX subsystem so that
it can be found and executed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]