io.reactivex.rxjava3.core.SingleEmitter Java Examples

The following examples show how to use io.reactivex.rxjava3.core.SingleEmitter. 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: Rx3Apollo.java    From apollo-android with MIT License 6 votes vote down vote up
/**
 * Converts an {@link ApolloStoreOperation} to a Single.
 *
 * @param operation the ApolloStoreOperation to convert
 * @param <T>       the value type
 * @return the converted Single
 */
@NotNull
@CheckReturnValue
public static <T> Single<T> from(@NotNull final ApolloStoreOperation<T> operation) {
  checkNotNull(operation, "operation == null");
  return Single.create(new SingleOnSubscribe<T>() {
    @Override
    public void subscribe(final SingleEmitter<T> emitter) {
      operation.enqueue(new ApolloStoreOperation.Callback<T>() {
        @Override
        public void onSuccess(T result) {
          emitter.onSuccess(result);
        }

        @Override
        public void onFailure(Throwable t) {
          emitter.onError(t);
        }
      });
    }
  });
}
 
Example #2
Source File: RemoteLndSingleObserver.java    From zap-android with MIT License 4 votes vote down vote up
RemoteLndSingleObserver(SingleEmitter<V> emitter) {
    mEmitter = emitter;
}
 
Example #3
Source File: SingleDataProducerTask.java    From java-11-examples with Apache License 2.0 4 votes vote down vote up
public SingleDataProducerTask(SingleEmitter<DataItem> emitter, SingleDataQuery dataQuery) {
    this.emitter = emitter;
    this.dataQuery = dataQuery;
    this.disposed = false;
}
 
Example #4
Source File: SingleOnSubscribeDataProducer.java    From java-11-examples with Apache License 2.0 4 votes vote down vote up
@Override
public void subscribe(SingleEmitter<DataItem> emitter) throws Throwable {
    this.executor.execute(new SingleDataProducerTask(emitter, dataQuery));
}