protected String name;
/**
+ * prestart threads?
+ */
+ protected boolean prestartminSpareThreads = false;
+
+ /**
* The maximum number of elements that can queue up before we reject them
*/
protected int maxQueueSize = Integer.MAX_VALUE;
taskqueue = new TaskQueue(maxQueueSize);
TaskThreadFactory tf = new TaskThreadFactory(namePrefix,daemon,getThreadPriority());
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf);
+ if (prestartminSpareThreads) {
+ executor.prestartAllCoreThreads();
+ }
taskqueue.setParent(executor);
setState(LifecycleState.STARTING);
return name;
}
+ public boolean isPrestartminSpareThreads() {
+
+ return prestartminSpareThreads;
+ }
public void setThreadPriority(int threadPriority) {
this.threadPriority = threadPriority;
}
}
}
+ public void setPrestartminSpareThreads(boolean prestartminSpareThreads) {
+ this.prestartminSpareThreads = prestartminSpareThreads;
+ }
+
public void setName(String name) {
this.name = name;
}
<section name="Tomcat 7.0.0 (markt)">
<subsection name="Catalina">
<changelog>
+ <add>
+ <bug>43642</bug>: Add prestartminSpareThreads attribute for Executor. (jfclere)
+ </add>
<update>
Update Servlet support to the Servlet 3.0 specification. Note
asynchronous support is not yet complete. (markt/fhanik)
<p>(int) The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less
or equal to minSpareThreads. Default value is <code>60000</code>(1 minute)</p>
</attribute>
+ <attribute name="prestartminSpareThreads" required="false">
+ <p>(boolean) Whether minSpareThreads should be started when starting the Executor or not,
+ the default is <code>false</code></p>
+ </attribute>
</attributes>