changeset 262:5cab846eb2a3

flys/issue65: Set number of max. restlet threads to 1024 and make it configurable. artifacts/trunk@1943 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 18 May 2011 10:10:11 +0000
parents f3d970a832ff
children c0fb96f88ad1
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 17 09:57:10 2011 +0000
+++ b/ChangeLog	Wed May 18 10:10:11 2011 +0000
@@ -1,3 +1,10 @@
+2011-04-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java:
+	  With '/artifact-database/rest-server/max-threads/text()' in conf.xml
+	  you can set the number of threads used by the restlet server.
+	  Defaults to 1024 now. Another attempt/workaround to cope with flys/issue65.
+
 2011-05-17  Ingo Weinzierl <ingo@intevation.de>
 
 	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java	Tue May 17 09:57:10 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java	Wed May 18 10:10:11 2011 +0000
@@ -49,6 +49,12 @@
      */
     public static final int DEFAULT_PORT = 8181;
 
+    public static final String MAX_THREADS =
+        "/artifact-database/rest-server/max-threads/text()";
+
+    public static final String MAX_THREADS_DEFAULT =
+        "1024";
+
     /**
      * Builds a RestApp wrapped around the given artifact database,
      * and bind this application to HTTP server. The HTTP server
@@ -62,6 +68,7 @@
     public static void startAsServer(ArtifactDatabase db) {
         String portString   = Config.getStringXPath(REST_PORT);
         String listenString = Config.getStringXPath(LISTEN_INTERFACE);
+        String maxThreads   = Config.getStringXPath(MAX_THREADS);
 
         int port = DEFAULT_PORT;
 
@@ -93,7 +100,10 @@
 
         component.getServers().add(server);
 
-        server.getContext().getParameters().add("maxThreads", "512");
+        server.getContext().getParameters().add(
+            "maxThreads", maxThreads != null
+                ? maxThreads
+                : MAX_THREADS_DEFAULT);
 
         component.getDefaultHost().attach(app);
 

http://dive4elements.wald.intevation.org