@@ -86,6 +86,8 @@ public class ServerDaemon implements Daemon {
86
86
private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576 ;
87
87
private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys" ;
88
88
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" ;
89
91
90
92
////////////////////////////////////////////////////////
91
93
/////////////// Server Configuration ///////////////////
@@ -106,6 +108,8 @@ public class ServerDaemon implements Daemon {
106
108
private String keystoreFile ;
107
109
private String keystorePassword ;
108
110
private String webAppLocation ;
111
+ private int minThreads ;
112
+ private int maxThreads ;
109
113
110
114
//////////////////////////////////////////////////
111
115
/////////////// Public methods ///////////////////
@@ -147,6 +151,8 @@ public void init(final DaemonContext context) {
147
151
setSessionTimeout (Integer .valueOf (properties .getProperty (SESSION_TIMEOUT , "30" )));
148
152
setMaxFormContentSize (Integer .valueOf (properties .getProperty (REQUEST_CONTENT_SIZE_KEY , String .valueOf (DEFAULT_REQUEST_CONTENT_SIZE ))));
149
153
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" )));
150
156
} catch (final IOException e ) {
151
157
logger .warn ("Failed to read configuration from server.properties file" , e );
152
158
} finally {
@@ -164,8 +170,8 @@ public void init(final DaemonContext context) {
164
170
public void start () throws Exception {
165
171
// Thread pool
166
172
final QueuedThreadPool threadPool = new QueuedThreadPool ();
167
- threadPool .setMinThreads (10 );
168
- threadPool .setMaxThreads (500 );
173
+ threadPool .setMinThreads (minThreads );
174
+ threadPool .setMaxThreads (maxThreads );
169
175
170
176
// Jetty Server
171
177
server = new Server (threadPool );
@@ -394,4 +400,12 @@ public void setMaxFormContentSize(int maxFormContentSize) {
394
400
public void setMaxFormKeys (int maxFormKeys ) {
395
401
this .maxFormKeys = maxFormKeys ;
396
402
}
403
+
404
+ public void setMinThreads (int minThreads ) {
405
+ this .minThreads = minThreads ;
406
+ }
407
+
408
+ public void setMaxThreads (int maxThreads ) {
409
+ this .maxThreads = maxThreads ;
410
+ }
397
411
}
0 commit comments