use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class SingleSchedulerTest method zeroPeriodRejectedExecution.
@Test
public void zeroPeriodRejectedExecution() throws Throwable {
TestHelper.withErrorTracking(errors -> {
Scheduler s = RxJavaPlugins.createSingleScheduler(new RxThreadFactory("Test"));
s.shutdown();
Runnable run = mock(Runnable.class);
s.schedulePeriodicallyDirect(run, 1, 0, TimeUnit.MILLISECONDS);
Thread.sleep(100);
verify(run, never()).run();
TestHelper.assertUndeliverable(errors, 0, RejectedExecutionException.class);
});
}
use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class ExecutorSchedulerTest method runnableDisposedAsyncTimed2.
@Test
public void runnableDisposedAsyncTimed2() throws Exception {
ExecutorService executorScheduler = Executors.newScheduledThreadPool(1, new RxThreadFactory("TestCustomPoolTimed"));
try {
final Scheduler s = Schedulers.from(executorScheduler);
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS);
while (!d.isDisposed()) {
Thread.sleep(1);
}
} finally {
executorScheduler.shutdownNow();
}
}
Aggregations