Java Code Examples for io.reactivex.Single#subscribeOn()

The following examples show how to use io.reactivex.Single#subscribeOn() . These examples are extracted from open source projects. 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 Project: burstkit4j   File: RxTestUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static <T> T testSingle(Single<T> single) {
    assertNotNull("Single itself was null", single);
    // If you don't do this it blocks trying to do the operation and therefore can't observe the results
    single = single.subscribeOn(Schedulers.io());
    TestObserver<T> observer = single.test();
    assertTrue("Observer failed to reach terminal event", observer.awaitTerminalEvent());
    observer.assertNoErrors();
    T object = observer.values().get(0);
    assertNotNull("Returned object was null - RxJava should not allow this", object);
    return object;
}
 
Example 2
Source Project: storio   File: RxJavaUtils.java    License: Apache License 2.0 5 votes vote down vote up
@CheckResult
@NonNull
public static <T> Single<T> subscribeOn(
        @NonNull StorIOSQLite storIOSQLite,
        @NonNull Single<T> single
) {
    final Scheduler scheduler = storIOSQLite.defaultRxScheduler();
    return scheduler != null ? single.subscribeOn(scheduler) : single;
}
 
Example 3
Source Project: storio   File: RxJavaUtils.java    License: Apache License 2.0 5 votes vote down vote up
@CheckResult
@NonNull
public static <T> Single<T> subscribeOn(
        @NonNull StorIOContentResolver storIOContentResolver,
        @NonNull Single<T> single
) {
    final Scheduler scheduler = storIOContentResolver.defaultRxScheduler();
    return scheduler != null ? single.subscribeOn(scheduler) : single;
}
 
Example 4
Source Project: burstkit4j   File: GrpcBurstNodeService.java    License: Apache License 2.0 4 votes vote down vote up
private <T> Single<T> assign(Single<T> single) {
    return single.subscribeOn(BurstKitUtils.defaultBurstNodeServiceScheduler());
}