/** * Checks if the {@code failOnNonBlockingScheduler} plugin setting is enabled and the current * thread is a Scheduler sensitive to blocking operators. * @throws IllegalStateException if the {@code failOnNonBlockingScheduler} and the current thread is sensitive to blocking */ public static void verifyNonBlocking() { if (RxJavaCommonPlugins.isFailOnNonBlockingScheduler() && (Thread.currentThread() instanceof NonBlockingThread || RxJavaCommonPlugins.onBeforeBlocking())) { throw new IllegalStateException("Attempt to block on a Scheduler " + Thread.currentThread().getName() + " that doesn't support blocking operators as they may lead to deadlock"); } } }
/** * Checks if the {@code failOnNonBlockingScheduler} plugin setting is enabled and the current * thread is a Scheduler sensitive to blocking operators. * @throws IllegalStateException if the {@code failOnNonBlockingScheduler} and the current thread is sensitive to blocking */ public static void verifyNonBlocking() { if (RxJavaCommonPlugins.isFailOnNonBlockingScheduler() && (Thread.currentThread() instanceof NonBlockingThread || RxJavaCommonPlugins.onBeforeBlocking())) { throw new IllegalStateException("Attempt to block on a Scheduler " + Thread.currentThread().getName() + " that doesn't support blocking operators as they may lead to deadlock"); } } }
/** * Checks if the {@code failOnNonBlockingScheduler} plugin setting is enabled and the current * thread is a Scheduler sensitive to blocking operators. * @throws IllegalStateException if the {@code failOnNonBlockingScheduler} and the current thread is sensitive to blocking */ public static void verifyNonBlocking() { if (RxJavaCommonPlugins.isFailOnNonBlockingScheduler() && (Thread.currentThread() instanceof NonBlockingThread || RxJavaCommonPlugins.onBeforeBlocking())) { throw new IllegalStateException("Attempt to block on a Scheduler " + Thread.currentThread().getName() + " that doesn't support blocking operators as they may lead to deadlock"); } } }