@ SuppressWarnings ( "WeakerAccess" ) protected boolean isJettyWithJMX ( ClassLoaderLeakPreventor preventor ) { final ClassLoader classLoader = preventor . getClassLoader ( ) ; try { // If package org.eclipse.jetty is found, we may be running under jetty if ( classLoader . getResource ( "org/eclipse/jetty" ) == null ) { return false ; } Class . forName ( "org.eclipse.jetty.jmx.MBeanContainer" , false , classLoader . getParent ( ) ) ; // JMX enabled? Class . forName ( "org.eclipse.jetty.webapp.WebAppContext" , false , classLoader . getParent ( ) ) ; } catch ( Exception ex ) { // For example ClassNotFoundException return false ; } // Seems we are running in Jetty with JMX enabled return true ; }
Are we running in Jetty with JMX enabled?