File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
src/main/java/rx/schedulers Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 2424import rx .subscriptions .CompositeSubscription ;
2525import rx .subscriptions .Subscriptions ;
2626
27- import java .util .Iterator ;
2827import java .util .concurrent .*;
2928import java .util .concurrent .atomic .AtomicIntegerFieldUpdater ;
3029
@@ -84,12 +83,11 @@ void evictExpiredWorkers() {
8483 if (!expiringWorkerQueue .isEmpty ()) {
8584 long currentTimestamp = now ();
8685
87- Iterator <ThreadWorker > threadWorkerIterator = expiringWorkerQueue .iterator ();
88- while (threadWorkerIterator .hasNext ()) {
89- ThreadWorker threadWorker = threadWorkerIterator .next ();
86+ for (ThreadWorker threadWorker : expiringWorkerQueue ) {
9087 if (threadWorker .getExpirationTime () <= currentTimestamp ) {
91- threadWorkerIterator .remove ();
92- threadWorker .unsubscribe ();
88+ if (expiringWorkerQueue .remove (threadWorker )) {
89+ threadWorker .unsubscribe ();
90+ }
9391 } else {
9492 // Queue is ordered with the worker that will expire first in the beginning, so when we
9593 // find a non-expired worker we can stop evicting.
You can’t perform that action at this time.
0 commit comments