1122 |
|
public void shutdown() { |
1123 |
|
checkPermission(); |
1124 |
|
transitionRunStateTo(SHUTDOWN); |
1125 |
< |
if (canTerminateOnShutdown(runControl)) |
1125 |
> |
if (canTerminateOnShutdown(runControl)) { |
1126 |
> |
if (workers == null) { // shutting down before workers created |
1127 |
> |
final ReentrantLock lock = this.workerLock; |
1128 |
> |
lock.lock(); |
1129 |
> |
try { |
1130 |
> |
if (workers == null) { |
1131 |
> |
terminate(); |
1132 |
> |
transitionRunStateTo(TERMINATED); |
1133 |
> |
termination.signalAll(); |
1134 |
> |
} |
1135 |
> |
|
1136 |
> |
} finally { |
1137 |
> |
lock.unlock(); |
1138 |
> |
} |
1139 |
> |
} |
1140 |
|
terminateOnShutdown(); |
1141 |
+ |
} |
1142 |
|
} |
1143 |
|
|
1144 |
|
/** |