@@ -86,6 +86,8 @@ public class ServerDaemon implements Daemon {
8686 private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576 ;
8787 private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys" ;
8888 private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000 ;
89+ private static final String THREADS_MIN = "threads.min" ;
90+ private static final String THREADS_MAX = "threads.max" ;
8991
9092 ////////////////////////////////////////////////////////
9193 /////////////// Server Configuration ///////////////////
@@ -106,6 +108,8 @@ public class ServerDaemon implements Daemon {
106108 private String keystoreFile ;
107109 private String keystorePassword ;
108110 private String webAppLocation ;
111+ private int minThreads ;
112+ private int maxThreads ;
109113
110114 //////////////////////////////////////////////////
111115 /////////////// Public methods ///////////////////
@@ -147,6 +151,8 @@ public void init(final DaemonContext context) {
147151 setSessionTimeout (Integer .valueOf (properties .getProperty (SESSION_TIMEOUT , "30" )));
148152 setMaxFormContentSize (Integer .valueOf (properties .getProperty (REQUEST_CONTENT_SIZE_KEY , String .valueOf (DEFAULT_REQUEST_CONTENT_SIZE ))));
149153 setMaxFormKeys (Integer .valueOf (properties .getProperty (REQUEST_MAX_FORM_KEYS_KEY , String .valueOf (DEFAULT_REQUEST_MAX_FORM_KEYS ))));
154+ setMinThreads (Integer .valueOf (properties .getProperty (THREADS_MIN , "10" )));
155+ setMaxThreads (Integer .valueOf (properties .getProperty (THREADS_MAX , "500" )));
150156 } catch (final IOException e ) {
151157 logger .warn ("Failed to read configuration from server.properties file" , e );
152158 } finally {
@@ -164,8 +170,8 @@ public void init(final DaemonContext context) {
164170 public void start () throws Exception {
165171 // Thread pool
166172 final QueuedThreadPool threadPool = new QueuedThreadPool ();
167- threadPool .setMinThreads (10 );
168- threadPool .setMaxThreads (500 );
173+ threadPool .setMinThreads (minThreads );
174+ threadPool .setMaxThreads (maxThreads );
169175
170176 // Jetty Server
171177 server = new Server (threadPool );
@@ -394,4 +400,12 @@ public void setMaxFormContentSize(int maxFormContentSize) {
394400 public void setMaxFormKeys (int maxFormKeys ) {
395401 this .maxFormKeys = maxFormKeys ;
396402 }
403+
404+ public void setMinThreads (int minThreads ) {
405+ this .minThreads = minThreads ;
406+ }
407+
408+ public void setMaxThreads (int maxThreads ) {
409+ this .maxThreads = maxThreads ;
410+ }
397411}
0 commit comments