Java Code Examples for io.reactivex.plugins.RxJavaPlugins#setOnFlowableAssembly()
The following examples show how to use
io.reactivex.plugins.RxJavaPlugins#setOnFlowableAssembly() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxJavaAssemblyTracking.java From RxJava2Debug with Apache License 2.0 | 6 votes |
/** * Disable the assembly tracking. */ public static void disable() { if (lock.compareAndSet(false, true)) { RxJavaPlugins.setOnCompletableAssembly(null); RxJavaPlugins.setOnSingleAssembly(null); RxJavaPlugins.setOnMaybeAssembly(null); RxJavaPlugins.setOnObservableAssembly(null); RxJavaPlugins.setOnFlowableAssembly(null); RxJavaPlugins.setOnConnectableObservableAssembly(null); RxJavaPlugins.setOnConnectableFlowableAssembly(null); RxJavaPlugins.setOnParallelAssembly(null); lock.set(false); } }
Example 2
Source File: RequestContextAssembly.java From armeria with Apache License 2.0 | 6 votes |
/** * Disable {@link RequestContext} during operators. */ public static synchronized void disable() { if (!enabled) { return; } RxJavaPlugins.setOnObservableAssembly(oldOnObservableAssembly); oldOnObservableAssembly = null; RxJavaPlugins.setOnConnectableObservableAssembly(oldOnConnectableObservableAssembly); oldOnConnectableObservableAssembly = null; RxJavaPlugins.setOnCompletableAssembly(oldOnCompletableAssembly); oldOnCompletableAssembly = null; RxJavaPlugins.setOnSingleAssembly(oldOnSingleAssembly); oldOnSingleAssembly = null; RxJavaPlugins.setOnMaybeAssembly(oldOnMaybeAssembly); oldOnMaybeAssembly = null; RxJavaPlugins.setOnFlowableAssembly(oldOnFlowableAssembly); oldOnFlowableAssembly = null; RxJavaPlugins.setOnConnectableFlowableAssembly(oldOnConnectableFlowableAssembly); oldOnConnectableFlowableAssembly = null; RxJavaPlugins.setOnParallelAssembly(oldOnParallelAssembly); oldOnParallelAssembly = null; enabled = false; }
Example 3
Source File: HelperTest.java From vertx-rx with Apache License 2.0 | 6 votes |
@Test public void testToFlowableAssemblyHook() { FakeStream<String> stream = new FakeStream<>(); try { final Flowable<String> justMe = Flowable.just("me"); RxJavaPlugins.setOnFlowableAssembly(new Function<Flowable, Flowable>() { @Override public Flowable apply(Flowable f) { return justMe; } }); Flowable<String> flowable = FlowableHelper.toFlowable(stream); assertSame(flowable, justMe); Flowable<String> flowableFn = FlowableHelper.toFlowable(stream, identity()); assertSame(flowableFn, justMe); Flowable<String> flowableSize = FlowableHelper.toFlowable(stream, 1); assertSame(flowableSize, justMe); } finally { RxJavaPlugins.reset(); } }
Example 4
Source File: RxJavaHooksUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void givenFlowable_whenAssembled_shouldExecuteTheHook() { RxJavaPlugins.setOnFlowableAssembly(flowable -> { hookCalled = true; return flowable; }); Flowable.range(1, 10); assertTrue(hookCalled); }
Example 5
Source File: CurrentTraceContextAssemblyTracking.java From brave with Apache License 2.0 | 5 votes |
/** Disables the validation hooks be resetting the assembled hooks to none. */ public static void disable() { RxJavaPlugins.setOnCompletableAssembly(null); RxJavaPlugins.setOnSingleAssembly(null); RxJavaPlugins.setOnMaybeAssembly(null); RxJavaPlugins.setOnObservableAssembly(null); RxJavaPlugins.setOnFlowableAssembly(null); RxJavaPlugins.setOnConnectableObservableAssembly(null); RxJavaPlugins.setOnConnectableFlowableAssembly(null); RxJavaPlugins.setOnParallelAssembly(null); enabled = false; }
Example 6
Source File: RxSynchronousProfiler.java From akarnokd-misc with Apache License 2.0 | 4 votes |
public void stop() { RxJavaPlugins.setOnFlowableAssembly(null); RxJavaPlugins.setOnSingleAssembly(null); }
Example 7
Source File: RxSynchronousCoarseProfiler.java From akarnokd-misc with Apache License 2.0 | 4 votes |
public void stop() { RxJavaPlugins.setOnFlowableAssembly(null); RxJavaPlugins.setOnSingleAssembly(null); }