use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class ExecutorSchedulerFairTest method runnableDisposedAsyncTimed2.
@Test
public void runnableDisposedAsyncTimed2() throws Exception {
ExecutorService executorScheduler = Executors.newScheduledThreadPool(1, new RxThreadFactory("TestCustomPoolTimed"));
try {
final Scheduler s = Schedulers.from(executorScheduler, false, true);
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS);
while (!d.isDisposed()) {
Thread.sleep(1);
}
} finally {
executorScheduler.shutdownNow();
}
}
use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class ExecutorSchedulerInterruptibleTest method runnableDisposedAsyncTimed2.
@Test
public void runnableDisposedAsyncTimed2() throws Exception {
ExecutorService executorScheduler = Executors.newScheduledThreadPool(1, new RxThreadFactory("TestCustomPoolTimed"));
try {
final Scheduler s = Schedulers.from(executorScheduler, true);
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS);
while (!d.isDisposed()) {
Thread.sleep(1);
}
} finally {
executorScheduler.shutdownNow();
}
}
use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class IoSchedulerInternalTest method expireReuseRace.
@Test
public void expireReuseRace() {
ConcurrentLinkedQueue<ThreadWorker> expire = new ConcurrentLinkedQueue<>();
CompositeDisposable cd = new CompositeDisposable();
ThreadWorker tw = new ThreadWorker(new RxThreadFactory("IoExpiryTest"));
tw.dispose();
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
expire.add(tw);
cd.add(tw);
TestHelper.race(() -> CachedWorkerPool.evictExpiredWorkers(expire, cd), () -> expire.remove(tw));
}
}
use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class IoSchedulerInternalTest method noExpiredWorker.
@Test
public void noExpiredWorker() {
ConcurrentLinkedQueue<ThreadWorker> expire = new ConcurrentLinkedQueue<>();
CompositeDisposable cd = new CompositeDisposable();
ThreadWorker tw = new ThreadWorker(new RxThreadFactory("IoExpiryTest"));
tw.setExpirationTime(System.nanoTime() + 10_000_000_000L);
try {
expire.add(tw);
cd.add(tw);
CachedWorkerPool.evictExpiredWorkers(expire, cd);
assertFalse(tw.isDisposed());
assertFalse(expire.isEmpty());
} finally {
tw.dispose();
}
}
use of io.reactivex.rxjava3.internal.schedulers.RxThreadFactory in project RxJava by ReactiveX.
the class IoSchedulerInternalTest method expiredWorkerRemoved.
@Test
public void expiredWorkerRemoved() {
ConcurrentLinkedQueue<ThreadWorker> expire = new ConcurrentLinkedQueue<>();
CompositeDisposable cd = new CompositeDisposable();
ThreadWorker tw = new ThreadWorker(new RxThreadFactory("IoExpiryTest"));
try {
expire.add(tw);
cd.add(tw);
CachedWorkerPool.evictExpiredWorkers(expire, cd);
assertTrue(tw.isDisposed());
assertTrue(expire.isEmpty());
} finally {
tw.dispose();
}
}
Aggregations