当前位置: 首页>>代码示例>>Java>>正文


Java Disposables.disposed方法代码示例

本文整理汇总了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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:HandlerScheduler.java

示例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;
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:26,代码来源:EclipseScheduler.java

示例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;
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:26,代码来源:DisplayScheduler.java

示例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;
}
 
开发者ID:diffplug,项目名称:durian-swt,代码行数:26,代码来源:SwtExec.java

示例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));
}
 
开发者ID:Twister915,项目名称:pl,代码行数:14,代码来源:BukkitWorker.java

示例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();
	}
}
 
开发者ID:diffplug,项目名称:durian-rx,代码行数:10,代码来源:GuardedExecutor.java


注:本文中的io.reactivex.disposables.Disposables.disposed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。