Java 类io.reactivex.internal.disposables.EmptyDisposable 实例源码

项目:RxConditions    文件:MaybeIfThen.java   
@Override
protected void subscribeActual(MaybeObserver<? super T> observer) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (b) {
        then.subscribe(observer);
    } else {
        orElse.subscribe(observer);
    }
}
项目:RxConditions    文件:SingleIfThen.java   
@Override
protected void subscribeActual(@NonNull SingleObserver<? super T> observer) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (b) {
        then.subscribe(observer);
    } else {
        orElse.subscribe(observer);
    }
}
项目:RxConditions    文件:CompletableIfThen.java   
@Override
protected void subscribeActual(CompletableObserver observer) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (b) {
        then.subscribe(observer);
    } else {
        orElse.subscribe(observer);
    }
}
项目:RxConditions    文件:MaybeSwitchCase.java   
@Override
protected void subscribeActual(MaybeObserver<? super T> observer) {
    K key;
    MaybeSource<? extends T> source;

    try {
        key = caseSelector.call();

        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(observer);
}
项目:RxConditions    文件:SingleSwitchCase.java   
@Override
protected void subscribeActual(@NonNull SingleObserver<? super T> observer) {
    K key;
    SingleSource<? extends T> source;

    try {
        key = caseSelector.call();

        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(observer);
}
项目:RxConditions    文件:ObservableSwitchCase.java   
@Override
protected void subscribeActual(Observer<? super T> observer) {
    K key;
    ObservableSource<? extends T> source;

    try {
        key = caseSelector.call();

        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(observer);
}
项目:RxConditions    文件:CompletableSwitchCase.java   
@Override
protected void subscribeActual(CompletableObserver observer) {
    K key;
    CompletableSource source;

    try {
        key = caseSelector.call();

        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(observer);
}
项目:RxConditions    文件:ObservableIfThen.java   
@Override
protected void subscribeActual(Observer<? super T> observer) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (b) {
        then.subscribe(observer);
    } else {
        orElse.subscribe(observer);
    }
}
项目:RxDbflow    文件:DBFlowBaseSingle.java   
@Override
protected void subscribeActual(SingleObserver<? super Container> observer) {

    observer.onSubscribe(EmptyDisposable.INSTANCE);
    try {
        Container v =  run();
        if (v != null) {
            observer.onSuccess(v);
        } else {
            observer.onError(new NullPointerException("The callable returned a null value"));
        }
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        observer.onError(e);
    }
}
项目:RxJava2Extensions    文件:ObservableSwitchCase.java   
@Override
protected void subscribeActual(Observer<? super T> observer) {
    K key;
    ObservableSource<? extends T> source;

    try {
        key = caseSelector.call();

        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(observer);
}
项目:RxJava2Extensions    文件:ObservableIfThen.java   
@Override
protected void subscribeActual(Observer<? super T> observer) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (b) {
        then.subscribe(observer);
    } else {
        orElse.subscribe(observer);
    }
}
项目:akarnokd-misc    文件:ActorScheduler2.java   
@Override
public Disposable schedule(Runnable task) {
    WorkerRunnable wr = new WorkerRunnable(task, this);

    synchronized (this) {
        HashSet<WorkerRunnable> set = tasks;
        if (set == null) {
            return EmptyDisposable.INSTANCE;
        }
        set.add(wr);
    }

    actor.tell(wr, ActorRef.noSender());

    return wr;
}
项目:RxJava2Swing    文件:AsyncSwingScheduler.java   
@Override
public Disposable schedule(Runnable run) {
    WorkerTask wt = new WorkerTask(RxSwingPlugins.onSchedule(run));
    if (add(wt)) {
        EventQueue.invokeLater(wt);
        return wt;
    }
    return EmptyDisposable.INSTANCE;
}
项目:RxJava2Swing    文件:AsyncSwingScheduler.java   
@Override
public Disposable schedule(Runnable run, long delay, TimeUnit unit) {
    WorkerTimedTask wtt = new WorkerTimedTask(
            RxSwingPlugins.onSchedule(run),
            (int)unit.toMillis(delay),
            (int)Math.max(0, unit.toMillis(delay)), false
    );
    if (add(wtt)) {
        wtt.start();
        return wtt;
    }
    return EmptyDisposable.INSTANCE;
}
项目:RxJava2Swing    文件:AsyncSwingScheduler.java   
@Override
public Disposable schedulePeriodically(Runnable run, long initialDelay, long period, TimeUnit unit) {
    WorkerTimedTask wtt = new WorkerTimedTask(
            RxSwingPlugins.onSchedule(run),
            (int)unit.toMillis(initialDelay),
            (int)Math.max(0, unit.toMillis(period)), true
    );
    if (add(wtt)) {
        wtt.start();
        return wtt;
    }
    return EmptyDisposable.INSTANCE;
}
项目:RxDbflow    文件:DBFlowBaseMaybe.java   
@Override
protected void subscribeActual(MaybeObserver<? super Container> observer) {

    observer.onSubscribe(EmptyDisposable.INSTANCE);
    try {
        Container v = run();
        observer.onSuccess(v);
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        observer.onError(e);
    }
}