fix: when no overflow thread in pool, retry only after cas fails to set overflowThreadNumber to null

pull/1362/head
huangchengxing 1 year ago
parent 1bb7965f25
commit b2c6ab3694

@ -168,13 +168,13 @@ public class MaximumActiveThreadCountChecker implements ExecuteAwarePlugin {
while ((current = overflowThreadNumber.get()) != null) { while ((current = overflowThreadNumber.get()) != null) {
int curr = current.get(); int curr = current.get();
// it's aready no overflow thread // it's already no overflow thread
if (curr < 1) { if (curr < 1) {
// check whether the current value is effective, if not, try again // check whether the current value is effective, if not, try again
if (overflowThreadNumber.compareAndSet(current, null)) { if (overflowThreadNumber.compareAndSet(current, null)) {
continue; return false;
} }
return false; continue;
} }
// has overflow thread, try to cas to decrease the number of overflow threads // has overflow thread, try to cas to decrease the number of overflow threads

Loading…
Cancel
Save