Lines 74-79
Link Here
|
74 |
protected String name; |
74 |
protected String name; |
75 |
/** |
75 |
/** |
|
|
76 |
* prestart threads? |
77 |
*/ |
78 |
protected boolean prestartminSpareThreads = false; |
79 |
|
80 |
/** |
76 |
* The maximum number of elements that can queue up before we reject them |
81 |
* The maximum number of elements that can queue up before we reject them |
77 |
*/ |
82 |
*/ |
78 |
protected int maxQueueSize = Integer.MAX_VALUE; |
83 |
protected int maxQueueSize = Integer.MAX_VALUE; |
Lines 101-106
Link Here
|
101 |
taskqueue = new TaskQueue(maxQueueSize); |
106 |
taskqueue = new TaskQueue(maxQueueSize); |
102 |
TaskThreadFactory tf = new TaskThreadFactory(namePrefix,daemon,getThreadPriority()); |
107 |
TaskThreadFactory tf = new TaskThreadFactory(namePrefix,daemon,getThreadPriority()); |
103 |
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf); |
108 |
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf); |
|
|
109 |
if (prestartminSpareThreads) { |
110 |
executor.prestartAllCoreThreads(); |
111 |
} |
104 |
taskqueue.setParent(executor); |
112 |
taskqueue.setParent(executor); |
105 |
setState(LifecycleState.STARTING); |
113 |
setState(LifecycleState.STARTING); |
Lines 172-177
Link Here
|
172 |
return name; |
180 |
return name; |
173 |
} |
181 |
} |
|
|
182 |
public boolean isPrestartminSpareThreads() { |
183 |
|
184 |
return prestartminSpareThreads; |
185 |
} |
174 |
public void setThreadPriority(int threadPriority) { |
186 |
public void setThreadPriority(int threadPriority) { |
175 |
this.threadPriority = threadPriority; |
187 |
this.threadPriority = threadPriority; |
176 |
} |
188 |
} |
Lines 208-213
Link Here
|
208 |
public void setName(String name) { |
220 |
public void setName(String name) { |
209 |
this.name = name; |
221 |
this.name = name; |
210 |
} |
222 |
} |
|
|
223 |
|
224 |
public void setPrestartminSpareThreads(boolean prestartminSpareThreads) { |
225 |
this.prestartminSpareThreads = prestartminSpareThreads; |
226 |
} |
211 |
public void setMaxQueueSize(int size) { |
227 |
public void setMaxQueueSize(int size) { |
212 |
this.maxQueueSize = size; |
228 |
this.maxQueueSize = size; |