File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
src/main/java/rx/schedulers Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -45,18 +45,12 @@ public Worker createWorker() {
45
45
/* package accessible for unit tests */ TrampolineScheduler () {
46
46
}
47
47
48
- private static final ThreadLocal <PriorityQueue <TimedAction >> QUEUE = new ThreadLocal <PriorityQueue <TimedAction >>() {
49
- @ Override
50
- protected PriorityQueue <TimedAction > initialValue () {
51
- return new PriorityQueue <TimedAction >();
52
- }
53
- };
54
-
55
48
volatile int counter ;
56
49
static final AtomicIntegerFieldUpdater <TrampolineScheduler > COUNTER_UPDATER = AtomicIntegerFieldUpdater .newUpdater (TrampolineScheduler .class , "counter" );
57
50
58
51
private class InnerCurrentThreadScheduler extends Scheduler .Worker implements Subscription {
59
52
53
+ final PriorityQueue <TimedAction > queue = new PriorityQueue <TimedAction >();
60
54
private final BooleanSubscription innerSubscription = new BooleanSubscription ();
61
55
private final AtomicInteger wip = new AtomicInteger ();
62
56
@@ -76,7 +70,6 @@ private Subscription enqueue(Action0 action, long execTime) {
76
70
if (innerSubscription .isUnsubscribed ()) {
77
71
return Subscriptions .empty ();
78
72
}
79
- PriorityQueue <TimedAction > queue = QUEUE .get ();
80
73
final TimedAction timedAction = new TimedAction (action , execTime , COUNTER_UPDATER .incrementAndGet (TrampolineScheduler .this ));
81
74
queue .add (timedAction );
82
75
@@ -95,7 +88,7 @@ private Subscription enqueue(Action0 action, long execTime) {
95
88
96
89
@ Override
97
90
public void call () {
98
- PriorityQueue <TimedAction > _q = QUEUE . get () ;
91
+ PriorityQueue <TimedAction > _q = queue ;
99
92
if (_q != null ) {
100
93
_q .remove (timedAction );
101
94
}
You can’t perform that action at this time.
0 commit comments