本文整理汇总了Java中io.reactivex.Scheduler.Worker方法的典型用法代码示例。如果您正苦于以下问题:Java Scheduler.Worker方法的具体用法?Java Scheduler.Worker怎么用?Java Scheduler.Worker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Scheduler
的用法示例。
在下文中一共展示了Scheduler.Worker方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emit
import io.reactivex.Scheduler; //导入方法依赖的package包/类
private void emit() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(() -> {
emitLoop();
worker.dispose();
});
}
示例2: betweenPeriodicSchedulesReportsIdle
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void betweenPeriodicSchedulesReportsIdle() {
Scheduler.Worker worker = scheduler.createWorker();
CountingRunnable action = new CountingRunnable();
worker.schedulePeriodically(action, 0, 1, SECONDS);
delegate.triggerActions();
assertEquals(1, action.count());
delegate.advanceTimeBy(500, MILLISECONDS);
assertIdle(1);
}
示例3: runningWorkReportsBusy
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void runningWorkReportsBusy() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new Runnable() {
@Override public void run() {
assertBusy();
}
});
delegate.triggerActions();
}
示例4: unsubscribingScheduledWorkWhileRunningWorkReportsBusy
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void unsubscribingScheduledWorkWhileRunningWorkReportsBusy() {
final Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new Runnable() {
@Override public void run() {
worker.dispose();
assertBusy();
}
});
delegate.triggerActions();
}
示例5: createWorker
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Override
public Scheduler.Worker createWorker() {
return getDelegateScheduler().createWorker();
}
示例6: scheduledWorkReportsBusy
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void scheduledWorkReportsBusy() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new CountingRunnable());
assertBusy();
}
示例7: scheduledWorkUnsubscribedReportsIdle
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void scheduledWorkUnsubscribedReportsIdle() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new CountingRunnable()).dispose();
assertIdle(1);
}
示例8: scheduleWithZeroDelayReportsBusy
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void scheduleWithZeroDelayReportsBusy() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new CountingRunnable(), 0, SECONDS);
assertBusy();
}
示例9: scheduleWithNonZeroDelayReportsIdle
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void scheduleWithNonZeroDelayReportsIdle() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new CountingRunnable(), 1, SECONDS);
assertIdle(0);
}
示例10: schedulePeriodicallyWithZeroDelayReportsBusy
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void schedulePeriodicallyWithZeroDelayReportsBusy() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedulePeriodically(new CountingRunnable(), 0, 1, SECONDS);
assertBusy();
}
示例11: schedulePeriodicallyWithNonZeroDelayReportsIdle
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void schedulePeriodicallyWithNonZeroDelayReportsIdle() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedulePeriodically(new CountingRunnable(), 1, 1, SECONDS);
assertIdle(0);
}
示例12: unsubscribingScheduledWorksReportsIdle
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void unsubscribingScheduledWorksReportsIdle() {
Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new CountingRunnable());
worker.dispose();
assertIdle(1);
}
示例13: scheduleWorkAfterUnsubscribedReportsIdle
import io.reactivex.Scheduler; //导入方法依赖的package包/类
@Test public void scheduleWorkAfterUnsubscribedReportsIdle() {
Scheduler.Worker worker = scheduler.createWorker();
worker.dispose();
worker.schedule(new CountingRunnable());
assertIdle(0);
}