FELIX-6182 : Make jetty stop timeout configurable. Apply patch from Simon Wimmesberger. This closes #203
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1871702 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
index 50f6585..9e48814 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
@@ -428,6 +428,9 @@
"If this property is set, each http context gets a unique session id (derived from the container session).",
HttpConfig.DEFAULT_UNIQUE_SESSION_ID,
bundle.getBundleContext().getProperty(HttpConfig.PROP_UNIQUE_SESSION_ID)));
+ adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_STOP_TIMEOUT, "Server stop timeout",
+ "If not -1, stop timeout for the server in milliseconds.", -1L,
+ bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_STOP_TIMEOUT)));
return new ObjectClassDefinition()
{
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index a380cd6..549c7fe 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -263,6 +263,9 @@
/** Felix specific property to specify the excluded mime types. */
public static final String FELIX_JETTY_GZIP_EXCLUDED_MIME_TYPES = "org.apache.felix.jetty.gzip.excludedMimeTypes";
+
+ /** Felix specific property to specify the stop timeout of the jetty server */
+ public static final String FELIX_JETTY_STOP_TIMEOUT = "org.apache.felix.jetty.stopTimeout";
private static String validateContextPath(String ctxPath)
{
@@ -661,6 +664,10 @@
return getStringArrayProperty(FELIX_JETTY_GZIP_EXCLUDED_MIME_TYPES, new String[0]);
}
+ public long getStopTimeout() {
+ return getLongProperty(FELIX_JETTY_STOP_TIMEOUT, -1l);
+ }
+
public void reset()
{
update(null);
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index bc72f7b..a4b99c8 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -322,6 +322,11 @@
this.server.insertHandler(gzipHandler);
}
+ if(this.config.getStopTimeout() != -1)
+ {
+ this.server.setStopTimeout(this.config.getStopTimeout());
+ }
+
this.server.start();
// session id manager is only available after server is started