Expose Jetty JMX extensions
Jetty by default provides set of MBeans that can be registered in JMX. This patch adds new configuration option called httpd.registerMBeans, by default set to false, to control this behavior. Change-Id: I3771ed3bb755240d7d90e9f1f1d7e7f84ff33ce3 Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
This commit is contained in:
parent
2b3a5badc9
commit
011cfedc61
@ -1909,6 +1909,12 @@ If not absolute, the path is resolved relative to `$site_path`.
|
||||
If the file doesn't exist or can't be read the default robots.txt file
|
||||
bundled with the .war will be used instead.
|
||||
|
||||
[[httpd.registerMBeans]]httpd.registerMBeans::
|
||||
+
|
||||
Enable (or disable) registration of Jetty MBeans for Java JMX.
|
||||
+
|
||||
By default, false.
|
||||
|
||||
[[index]]
|
||||
=== Section index
|
||||
|
||||
|
@ -115,6 +115,7 @@ java_library2(
|
||||
'//lib/guice:guice-servlet',
|
||||
'//lib/jetty:server',
|
||||
'//lib/jetty:servlet',
|
||||
'//lib/jetty:jmx',
|
||||
'//lib/jgit:jgit',
|
||||
'//lib/log:api',
|
||||
'//lib/log:log4j',
|
||||
|
@ -39,6 +39,7 @@ import com.google.inject.servlet.GuiceFilter;
|
||||
import com.google.inject.servlet.GuiceServletContextListener;
|
||||
|
||||
import org.eclipse.jetty.http.HttpScheme;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
@ -58,6 +59,7 @@ import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.util.BlockingArrayQueue;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
@ -75,6 +77,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@ -171,6 +174,13 @@ public class JettyServer {
|
||||
handler.setHandler(app);
|
||||
app = handler;
|
||||
}
|
||||
if (cfg.getBoolean("httpd", "registerMBeans", false)) {
|
||||
MBeanContainer mbean =
|
||||
new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
|
||||
httpd.addEventListener(mbean);
|
||||
httpd.addBean(Log.getRootLogger());
|
||||
httpd.addBean(mbean);
|
||||
}
|
||||
|
||||
httpd.setHandler(app);
|
||||
httpd.setStopAtShutdown(false);
|
||||
|
@ -59,6 +59,18 @@ maven_jar(
|
||||
exclude = EXCLUDE,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'jmx',
|
||||
id = 'org.eclipse.jetty:jetty-jmx:' + VERSION,
|
||||
sha1 = 'eb1492a8c6362410f84c97907b2ffb94c4dfcc2f',
|
||||
license = 'Apache2.0',
|
||||
exported_deps = [
|
||||
':continuation',
|
||||
':http',
|
||||
],
|
||||
exclude = EXCLUDE,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'continuation',
|
||||
id = 'org.eclipse.jetty:jetty-continuation:' + VERSION,
|
||||
|
Loading…
x
Reference in New Issue
Block a user