Search in sources :

Example 1 with BooleanRunnable

use of io.reactivex.internal.schedulers.ExecutorScheduler.ExecutorWorker.BooleanRunnable in project RxJava by ReactiveX.

the class ExecutorScheduler method scheduleDirect.

@NonNull
@Override
public Disposable scheduleDirect(@NonNull Runnable run) {
    Runnable decoratedRun = RxJavaPlugins.onSchedule(run);
    try {
        if (executor instanceof ExecutorService) {
            Future<?> f = ((ExecutorService) executor).submit(decoratedRun);
            return Disposables.fromFuture(f);
        }
        BooleanRunnable br = new BooleanRunnable(decoratedRun);
        executor.execute(br);
        return br;
    } catch (RejectedExecutionException ex) {
        RxJavaPlugins.onError(ex);
        return EmptyDisposable.INSTANCE;
    }
}
Also used : BooleanRunnable(io.reactivex.internal.schedulers.ExecutorScheduler.ExecutorWorker.BooleanRunnable) BooleanRunnable(io.reactivex.internal.schedulers.ExecutorScheduler.ExecutorWorker.BooleanRunnable) NonNull(io.reactivex.annotations.NonNull)

Aggregations

NonNull (io.reactivex.annotations.NonNull)1 BooleanRunnable (io.reactivex.internal.schedulers.ExecutorScheduler.ExecutorWorker.BooleanRunnable)1