475 |
|
Runnable getTask() { |
476 |
|
for (;;) { |
477 |
|
try { |
478 |
< |
switch(runState) { |
478 |
> |
switch (runState) { |
479 |
|
case RUNNING: { |
480 |
|
// untimed wait if core and not allowing core timeout |
481 |
|
if (poolSize <= corePoolSize && !allowCoreThreadTimeOut) |
622 |
|
} |
623 |
|
|
624 |
|
/** |
625 |
< |
* Interrupt thread if not running a task |
625 |
> |
* Interrupts thread if not running a task. |
626 |
|
*/ |
627 |
|
void interruptIfIdle() { |
628 |
|
final ReentrantLock runLock = this.runLock; |
636 |
|
} |
637 |
|
|
638 |
|
/** |
639 |
< |
* Interrupt thread even if running a task. |
639 |
> |
* Interrupts thread even if running a task. |
640 |
|
*/ |
641 |
|
void interruptNow() { |
642 |
|
thread.interrupt(); |
643 |
|
} |
644 |
|
|
645 |
|
/** |
646 |
< |
* Run a single task between before/after methods. |
646 |
> |
* Runs a single task between before/after methods. |
647 |
|
*/ |
648 |
|
private void runTask(Runnable task) { |
649 |
|
final ReentrantLock runLock = this.runLock; |
1452 |
|
* Method invoked prior to executing the given Runnable in the |
1453 |
|
* given thread. This method is invoked by thread <tt>t</tt> that |
1454 |
|
* will execute task <tt>r</tt>, and may be used to re-initialize |
1455 |
< |
* ThreadLocals, or to perform logging. This implementation does |
1456 |
< |
* nothing, but may be customized in subclasses. Note: To properly |
1457 |
< |
* nest multiple overridings, subclasses should generally invoke |
1458 |
< |
* <tt>super.beforeExecute</tt> at the end of this method. |
1455 |
> |
* ThreadLocals, or to perform logging. |
1456 |
> |
* |
1457 |
> |
* <p>This implementation does nothing, but may be customized in |
1458 |
> |
* subclasses. Note: To properly nest multiple overridings, subclasses |
1459 |
> |
* should generally invoke <tt>super.beforeExecute</tt> at the end of |
1460 |
> |
* this method. |
1461 |
|
* |
1462 |
|
* @param t the thread that will run task r. |
1463 |
|
* @param r the task that will be executed. |