Author: cziegeler
Date: Sat Jun 15 14:43:51 2019
New Revision: 1861401
URL: http://svn.apache.org/viewvc?rev=1861401&view=rev
Log:
FELIX-6086 : Jetty Statistics can be exposed via enabling MBeans but they are
never wired up. Apply patch by Caleb Champlin
Modified:
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
Modified:
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
URL:
http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java?rev=1861401&r1=1861400&r2=1861401&view=diff
==============================================================================
---
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
(original)
+++
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
Sat Jun 15 14:43:51 2019
@@ -149,10 +149,16 @@ class ConfigMetaTypeProvider implements
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_HTTP_MBEANS,
"Register MBeans",
"Whether or not to use register JMX MBeans from the servlet
container (Jetty). If this is " +
- "enabled Jetty Request and Connector statistics are also
enabled. The default is to not enable JMX.",
+ "enabled Jetty Request and Connector statistics are also
added. The default is to not enable JMX.",
false,
bundle.getBundleContext().getProperty(JettyConfig.FELIX_HTTP_MBEANS)));
+ adList.add(new
AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_STATISTICS_HANDLER_ENABLE,
+ "Enable Statistics",
+ "Whether or not to use enable Statistics in the servlet
container (Jetty).",
+ false,
+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_STATISTICS_HANDLER_ENABLE)));
+
adList.add(new
AttributeDefinitionImpl(JettyConfig.FELIX_SESSION_TIMEOUT,
"Session Timeout",
"Default lifetime of an HTTP session specified in a whole
number of minutes. If the timeout is 0 or less, sessions will by default never
timeout. The default is 0.",
Modified:
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
URL:
http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java?rev=1861401&r1=1861400&r2=1861401&view=diff
==============================================================================
---
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
(original)
+++
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
Sat Jun 15 14:43:51 2019
@@ -225,6 +225,9 @@ public final class JettyConfig
/** Felix specific property to define custom properties for the http
runtime service. */
public static final String FELIX_CUSTOM_HTTP_RUNTIME_PROPERTY_PREFIX =
"org.apache.felix.http.runtime.init.";
+ /** Felix specific property to specify whether the server should collect
statistics information (defaults to false) */
+ public static final String FELIX_JETTY_STATISTICS_HANDLER_ENABLE =
"org.apache.felix.jetty.statisticshandler.enable";
+
/** Felix specific property to specify whether the server should use a
server-wide gzip handler (defaults to true) */
public static final String FELIX_JETTY_GZIP_HANDLER_ENABLE =
"org.apache.felix.jetty.gziphandler.enable";
@@ -596,6 +599,9 @@ public final class JettyConfig
return getProperty(FELIX_HTTP_REQUEST_LOG_FILE_TIMEZONE, null);
}
+ public boolean isStatisticsHandlerEnabled() {
+ return getBooleanProperty(FELIX_JETTY_STATISTICS_HANDLER_ENABLE,
false);
+ }
public boolean isGzipHandlerEnabled() {
return getBooleanProperty(FELIX_JETTY_GZIP_HANDLER_ENABLE, false);
Modified:
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
URL:
http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java?rev=1861401&r1=1861400&r2=1861401&view=diff
==============================================================================
---
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
(original)
+++
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
Sat Jun 15 14:43:51 2019
@@ -288,11 +288,22 @@ public final class JettyService extends
{
this.mbeanServerTracker = new MBeanServerTracker(this.context,
this.server);
this.mbeanServerTracker.open();
- context.addBean(new StatisticsHandler());
+ if (!this.config.isStatisticsHandlerEnabled()) {
+ context.addBean(new StatisticsHandler());
+ }
}
this.server.setHandler(this.parent);
+ if (this.config.isStatisticsHandlerEnabled()) {
+ StatisticsHandler statisticsHandler = new StatisticsHandler();
+ this.server.insertHandler(statisticsHandler);
+ if (this.config.isRegisterMBeans())
+ {
+ context.addBean(statisticsHandler);
+ }
+ }
+
if (this.config.isGzipHandlerEnabled())
{
GzipHandler gzipHandler = new GzipHandler();