Skip to content

Commit 57b8276

Browse files
SleimanJneidiakarnokd
authored andcommitted
removes all anonymous inner classes (ReactiveX#5177)
1 parent 67f77fa commit 57b8276

File tree

11 files changed

+500
-328
lines changed

11 files changed

+500
-328
lines changed

src/main/java/io/reactivex/Scheduler.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,7 @@ public Disposable scheduleDirect(@NonNull Runnable run, long delay, @NonNull Tim
131131

132132
final Runnable decoratedRun = RxJavaPlugins.onSchedule(run);
133133

134-
w.schedule(new Runnable() {
135-
@Override
136-
public void run() {
137-
try {
138-
decoratedRun.run();
139-
} finally {
140-
w.dispose();
141-
}
142-
}
143-
}, delay, unit);
134+
w.schedule(new DisposeTask(decoratedRun, w), delay, unit);
144135

145136
return w;
146137
}
@@ -440,4 +431,23 @@ public boolean isDisposed() {
440431
return disposed;
441432
}
442433
}
434+
435+
static final class DisposeTask implements Runnable {
436+
final Runnable decoratedRun;
437+
final Worker w;
438+
439+
DisposeTask(Runnable decoratedRun, Worker w) {
440+
this.decoratedRun = decoratedRun;
441+
this.w = w;
442+
}
443+
444+
@Override
445+
public void run() {
446+
try {
447+
decoratedRun.run();
448+
} finally {
449+
w.dispose();
450+
}
451+
}
452+
}
443453
}

0 commit comments

Comments
 (0)