272 |
|
return t; |
273 |
|
} |
274 |
|
|
275 |
+ |
// addIfUnderCorePoolSize is non-private; accessible to ScheduledExecutor |
276 |
+ |
|
277 |
|
/** |
278 |
|
* Create and start a new thread running firstTask as its first |
279 |
|
* task, only if less than corePoolSize threads are running. |
281 |
|
* null if none) |
282 |
|
* @return true if successful. |
283 |
|
*/ |
282 |
– |
// non-private; accessible to ScheduledExecutor |
284 |
|
boolean addIfUnderCorePoolSize(Runnable firstTask) { |
285 |
|
Thread t = null; |
286 |
|
mainLock.lock(); |
735 |
|
} |
736 |
|
|
737 |
|
/** |
738 |
+ |
* Invokes <tt>shutdown</tt> when this executor is no longer |
739 |
+ |
* referenced. |
740 |
+ |
*/ |
741 |
+ |
protected void finalize() { |
742 |
+ |
shutdown(); |
743 |
+ |
} |
744 |
+ |
|
745 |
+ |
/** |
746 |
|
* Sets the thread factory used to create new threads. |
747 |
|
* |
748 |
|
* @param threadFactory the new thread factory |