本文整理汇总了Java中io.reactivex.disposables.Disposables.disposed方法的典型用法代码示例。如果您正苦于以下问题:Java Disposables.disposed方法的具体用法?Java Disposables.disposed怎么用?Java Disposables.disposed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.disposables.Disposables
的用法示例。
在下文中一共展示了Disposables.disposed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: schedule
import io.reactivex.disposables.Disposables; //导入方法依赖的package包/类
@Override
public Disposable schedule(Runnable run, long delay, TimeUnit unit) {
if (run == null) throw new NullPointerException("run == null");
if (unit == null) throw new NullPointerException("unit == null");
if (disposed) {
return Disposables.disposed();
}
run = RxJavaPlugins.onSchedule(run);
ScheduledRunnable scheduled = new ScheduledRunnable(handler, run);
Message message = Message.obtain(handler, scheduled);
message.obj = this; // Used as token for batch disposal of this worker's runnables.
handler.sendMessageDelayed(message, Math.max(0L, unit.toMillis(delay)));
// Re-check disposed state for removing in case we were racing a call to dispose().
if (disposed) {
handler.removeCallbacks(scheduled);
return Disposables.disposed();
}
return scheduled;
}
示例2: schedule
import io.reactivex.disposables.Disposables; //导入方法依赖的package包/类
@Override
public Disposable schedule(Runnable run, long delay, TimeUnit unit) {
if (run == null)
throw new NullPointerException("run == null");
if (unit == null)
throw new NullPointerException("unit == null");
if (disposed) {
return Disposables.disposed();
}
run = RxJavaPlugins.onSchedule(run);
ScheduledRunnable scheduled = new ScheduledRunnable(run);
executeRunnable(title, delay, unit, scheduled);
// Re-check disposed state for removing in case we were racing a
// call to dispose().
if (disposed) {
return Disposables.disposed();
}
return scheduled;
}
示例3: schedule
import io.reactivex.disposables.Disposables; //导入方法依赖的package包/类
@Override
public Disposable schedule(Runnable run, long delay, TimeUnit unit) {
if (run == null)
throw new NullPointerException("run == null");
if (unit == null)
throw new NullPointerException("unit == null");
if (disposed) {
return Disposables.disposed();
}
run = RxJavaPlugins.onSchedule(run);
ScheduledRunnable scheduled = new ScheduledRunnable(run);
executeRunnable(display, delay, unit, scheduled);
// Re-check disposed state for removing in case we were racing a
// call to dispose().
if (disposed) {
return Disposables.disposed();
}
return scheduled;
}
示例4: schedule
import io.reactivex.disposables.Disposables; //导入方法依赖的package包/类
@Override
public Disposable schedule(Runnable action) {
if (unsubscribed) {
return Disposables.disposed();
}
SwtScheduledAction a = new SwtScheduledAction(action, this);
synchronized (this) {
if (unsubscribed) {
return Disposables.disposed();
}
tasks.add(a);
}
exec.execute(a);
if (unsubscribed) {
a.cancel();
return Disposables.disposed();
}
return a;
}
示例5: schedule
import io.reactivex.disposables.Disposables; //导入方法依赖的package包/类
@Override
public Disposable schedule(@NonNull Runnable run, long delay, @NonNull TimeUnit unit) {
if (delay <= 0) {
if (canRunImmediately()) {
run.run();
return Disposables.disposed();
}
return new SingleDisposableTask(run);
}
return getGroup(delay, unit).add(new QueuedWork(run));
}
示例6: subscribe
import io.reactivex.disposables.Disposables; //导入方法依赖的package包/类
private Disposable subscribe(Supplier<Disposable> subscriber) {
if (!getGuard().isDisposed()) {
Disposable subscription = subscriber.get();
getGuard().runWhenDisposed(() -> subscription.dispose());
return subscription;
} else {
return Disposables.disposed();
}
}