# | Line 250 | Line 250 | public class ScheduledThreadPoolExecutor | |
---|---|---|
250 | } | |
251 | ||
252 | public boolean cancel(boolean mayInterruptIfRunning) { | |
253 | + | // The racy read of heapIndex below is benign: |
254 | + | // if heapIndex < 0, then OOTA guarantees that we have surely |
255 | + | // been removed; else we recheck under lock in remove() |
256 | boolean cancelled = super.cancel(mayInterruptIfRunning); | |
257 | if (cancelled && removeOnCancel && heapIndex >= 0) | |
258 | remove(this); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |