本文整理汇总了Java中io.reactivex.internal.functions.Functions.EMPTY_RUNNABLE属性的典型用法代码示例。如果您正苦于以下问题:Java Functions.EMPTY_RUNNABLE属性的具体用法?Java Functions.EMPTY_RUNNABLE怎么用?Java Functions.EMPTY_RUNNABLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类io.reactivex.internal.functions.Functions
的用法示例。
在下文中一共展示了Functions.EMPTY_RUNNABLE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFutureRace2
@Test
public void setFutureRace2() {
final Scheduler s = new ParallelScheduler(2, true);
try {
for (int i = 0; i < 1000; i++) {
final CompositeDisposable cd = new CompositeDisposable();
final TrackedAction tt = new TrackedAction(this, cd);
final FutureTask<Object> ft = new FutureTask<Object>(Functions.EMPTY_RUNNABLE, null);
Runnable r1 = new Runnable() {
@Override
public void run() {
tt.setFuture(ft);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
tt.future.set(TrackedAction.FINISHED);
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
} finally {
s.shutdown();
}
}
示例2: setFutureRace3
@Test
public void setFutureRace3() {
final Scheduler s = new ParallelScheduler(2, true);
try {
for (int i = 0; i < 1000; i++) {
final CompositeDisposable cd = new CompositeDisposable();
final TrackedAction tt = new TrackedAction(this, cd);
final FutureTask<Object> ft = new FutureTask<Object>(Functions.EMPTY_RUNNABLE, null);
Runnable r1 = new Runnable() {
@Override
public void run() {
tt.setFuture(ft);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
tt.future.set(TrackedAction.DISPOSED);
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
} finally {
s.shutdown();
}
}
示例3: fromFuture
@Test
public void fromFuture() {
FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
ft.run();
Perhaps.fromFuture(ft)
.test()
.assertResult(1);
}
示例4: fromFutureNull
@Test
public void fromFutureNull() {
FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, null);
ft.run();
Perhaps.fromFuture(ft)
.test()
.assertResult();
}
示例5: fromFutureTimeout
@Test
public void fromFutureTimeout() {
FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
Perhaps.fromFuture(ft, 1, TimeUnit.MILLISECONDS)
.test()
.assertFailure(TimeoutException.class);
}
示例6: fromFuture
@Test
public void fromFuture() {
FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
ft.run();
Solo.fromFuture(ft)
.test()
.assertResult(1);
}
示例7: fromFutureNull
@Test
public void fromFutureNull() {
FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, null);
ft.run();
Solo.fromFuture(ft)
.test()
.assertFailure(NoSuchElementException.class);
}
示例8: fromFutureTimeout
@Test
public void fromFutureTimeout() {
FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
Solo.fromFuture(ft, 1, TimeUnit.MILLISECONDS)
.test()
.assertFailure(TimeoutException.class);
}
示例9: startFuture
@Test
public void startFuture() {
final FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
ft.run();
AsyncFlowable.startFuture(new Callable<Future<Integer>>() {
@Override
public Future<Integer> call() throws Exception {
return ft;
}
})
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
示例10: startFutureNull
@Test
public void startFutureNull() {
final FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, null);
ft.run();
AsyncFlowable.startFuture(new Callable<Future<Integer>>() {
@Override
public Future<Integer> call() throws Exception {
return ft;
}
})
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult();
}
示例11: startFutureCustomScheduler
@Test
public void startFutureCustomScheduler() {
final FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
ft.run();
AsyncFlowable.startFuture(new Callable<Future<Integer>>() {
@Override
public Future<Integer> call() throws Exception {
return ft;
}
}, Schedulers.single())
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
示例12: deferFuture
@Test
public void deferFuture() {
final FutureTask<Flowable<Integer>> ft = new FutureTask<Flowable<Integer>>(Functions.EMPTY_RUNNABLE, Flowable.just(1));
ft.run();
AsyncFlowable.deferFuture(new Callable<Future<Flowable<Integer>>>() {
@Override
public Future<Flowable<Integer>> call() throws Exception {
return ft;
}
})
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
示例13: deferFutureCustomScheduler
@Test
public void deferFutureCustomScheduler() {
final FutureTask<Flowable<Integer>> ft = new FutureTask<Flowable<Integer>>(Functions.EMPTY_RUNNABLE, Flowable.just(1));
ft.run();
AsyncFlowable.deferFuture(new Callable<Future<Flowable<Integer>>>() {
@Override
public Future<Flowable<Integer>> call() throws Exception {
return ft;
}
}, Schedulers.single())
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
示例14: startFuture
@Test
public void startFuture() {
final FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, 1);
ft.run();
AsyncObservable.startFuture(new Callable<Future<Integer>>() {
@Override
public Future<Integer> call() throws Exception {
return ft;
}
})
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
示例15: startFutureNull
@Test
public void startFutureNull() {
final FutureTask<Integer> ft = new FutureTask<Integer>(Functions.EMPTY_RUNNABLE, null);
ft.run();
AsyncObservable.startFuture(new Callable<Future<Integer>>() {
@Override
public Future<Integer> call() throws Exception {
return ft;
}
})
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult();
}