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 24
24
import rx .subscriptions .CompositeSubscription ;
25
25
import rx .subscriptions .Subscriptions ;
26
26
27
- import java .util .Iterator ;
28
27
import java .util .concurrent .*;
29
28
import java .util .concurrent .atomic .AtomicIntegerFieldUpdater ;
30
29
@@ -84,12 +83,11 @@ void evictExpiredWorkers() {
84
83
if (!expiringWorkerQueue .isEmpty ()) {
85
84
long currentTimestamp = now ();
86
85
87
- Iterator <ThreadWorker > threadWorkerIterator = expiringWorkerQueue .iterator ();
88
- while (threadWorkerIterator .hasNext ()) {
89
- ThreadWorker threadWorker = threadWorkerIterator .next ();
86
+ for (ThreadWorker threadWorker : expiringWorkerQueue ) {
90
87
if (threadWorker .getExpirationTime () <= currentTimestamp ) {
91
- threadWorkerIterator .remove ();
92
- threadWorker .unsubscribe ();
88
+ if (expiringWorkerQueue .remove (threadWorker )) {
89
+ threadWorker .unsubscribe ();
90
+ }
93
91
} else {
94
92
// Queue is ordered with the worker that will expire first in the beginning, so when we
95
93
// find a non-expired worker we can stop evicting.
You can’t perform that action at this time.
0 commit comments