Java Code Examples for io.reactivex.plugins.RxJavaPlugins#onAssembly()

The following examples show how to use io.reactivex.plugins.RxJavaPlugins#onAssembly() . 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: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Flowable<Integer> scalarCallableFlowable(TraceContext expectedCallContext,
  RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new ScalarCallableFlowable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 2
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Single<Integer> callableSingle(TraceContext expectedCallContext, RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new CallableSingle() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 3
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Single<Integer> callableSingle(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new CallableSingle() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 4
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Observable<Integer> callableObservable(TraceContext expectedCallContext,
  RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new CallableObservable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 5
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Observable<Integer> callableObservable(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new CallableObservable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 6
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Completable scalarCallableCompletable(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new ScalarCallableCompletable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 7
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Flowable<Integer> callableFlowable(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new CallableFlowable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 8
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Maybe<Integer> scalarCallableMaybe(TraceContext expectedCallContext, RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new ScalarCallableMaybe() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 9
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Maybe<Integer> callableMaybe(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new CallableMaybe() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 10
Source File: OnErrorResumeStageFactory.java    From smallrye-reactive-streams-operators with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.OnErrorResume stage) {
    Function<Throwable, I> function = (Function<Throwable, I>) Objects.requireNonNull(stage).getFunction();
    Objects.requireNonNull(function);
    return source -> (Flowable<O>) RxJavaPlugins.onAssembly(new OnErrorReturn<>(source, function));
}
 
Example 11
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Observable<Integer> scalarCallableObservable(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new ScalarCallableObservable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 12
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Observable<Integer> scalarCallableObservable(TraceContext expectedCallContext,
  RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new ScalarCallableObservable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 13
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Completable scalarCallableCompletable(TraceContext expectedCallContext,
  RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new ScalarCallableCompletable() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 14
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Single<Integer> scalarCallableSingle(TraceContext expectedCallContext,
  RuntimeException exception) {
  return RxJavaPlugins.onAssembly(new ScalarCallableSingle() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      throw exception;
    }
  });
}
 
Example 15
Source File: JSONArrayObservable.java    From Tangram-Android with MIT License 5 votes vote down vote up
public static <T> Observable<T> fromJsonArray(JSONArray json) {
    ObjectHelper.requireNonNull(json, "items is null");
    if (json.length() == 0) {
        return empty();
    }
    return RxJavaPlugins.onAssembly(new JSONArrayObservable<T>(json));
}
 
Example 16
Source File: CurrentTraceContextAssemblyTrackingMatrixTest.java    From brave with Apache License 2.0 5 votes vote down vote up
Maybe<Integer> scalarCallableMaybe(TraceContext expectedCallContext) {
  return RxJavaPlugins.onAssembly(new ScalarCallableMaybe() {
    @Override public Integer call() {
      assertThat(currentTraceContext.get()).isEqualTo(expectedCallContext);
      return 1;
    }
  });
}
 
Example 17
Source File: AsyncResultSingle.java    From vertx-rx with Apache License 2.0 4 votes vote down vote up
public static <T> Single<T> toSingle(Consumer<Handler<AsyncResult<T>>> subscriptionConsumer) {
  return RxJavaPlugins.onAssembly(new AsyncResultSingle<T>(subscriptionConsumer));
}
 
Example 18
Source File: ObservableHelper.java    From vertx-rx with Apache License 2.0 4 votes vote down vote up
/**
 * Like {@link #toObservable(ReadStream)} but with a {@code mapping} function
 */
public static <T, U> Observable<U> toObservable(ReadStream<T> stream, Function<T, U> mapping) {
  return RxJavaPlugins.onAssembly(new ObservableReadStream<>(stream, mapping));
}
 
Example 19
Source File: FlowableHelper.java    From vertx-rx with Apache License 2.0 4 votes vote down vote up
/**
 * Like {@link #toFlowable(ReadStream)} but with a {@code mapping} function
 */
public static <T, U> Flowable<U> toFlowable(ReadStream<T> stream, Function<T, U> mapping) {
  return RxJavaPlugins.onAssembly(new FlowableReadStream<>(stream, FlowableReadStream.DEFAULT_MAX_BUFFER_SIZE, mapping));
}
 
Example 20
Source File: ObservableHelper.java    From vertx-rx with Apache License 2.0 2 votes vote down vote up
/**
 * Adapts a Vert.x {@link ReadStream <T>} to an RxJava {@link Observable <T>}. After
 * the stream is adapted to an observable, the original stream handlers should not be used anymore
 * as they will be used by the observable adapter.<p>
 *
 * @param stream the stream to adapt
 * @return the adapted observable
 */
public static <T> Observable<T> toObservable(ReadStream<T> stream) {
  return RxJavaPlugins.onAssembly(new ObservableReadStream<T, T>(stream, Function.identity()));
}