public final class

AsyncProcessor

extends FlowableProcessor<T>
java.lang.Object
   ↳ io.reactivex.Flowable<T>
     ↳ io.reactivex.processors.FlowableProcessor<T>
       ↳ io.reactivex.processors.AsyncProcessor<T>

Class Overview

Processor that emits the very last value followed by a completion event or the received error to Subscribers.

The implementation of onXXX methods are technically thread-safe but non-serialized calls to them may lead to undefined state in the currently subscribed Subscribers.

Summary

Public Methods
static <T> AsyncProcessor<T> create()
Creates a new AsyncProcessor.
Throwable getThrowable()
Returns the error that caused the Subject to terminate or null if the Subject hasn't terminated yet.
T getValue()
Returns a single value the Subject currently has or null if no such value exists.
T[] getValues(T[] array)
Returns a typed array containing a snapshot of all values of the Subject.
Object[] getValues()
Returns an Object array containing snapshot all values of the Subject.
boolean hasComplete()
Returns true if the subject has reached a terminal state through a complete event.
boolean hasSubscribers()
Returns true if the subject has subscribers.
boolean hasThrowable()
Returns true if the subject has reached a terminal state through an error event.
boolean hasValue()
Returns true if the subject has any value.
void onComplete()
void onError(Throwable t)
void onNext(T t)
void onSubscribe(Subscription s)
Protected Methods
void subscribeActual(Subscriber<? super T> s)
Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic.
[Expand]
Inherited Methods
From class io.reactivex.processors.FlowableProcessor
From class io.reactivex.Flowable
From class java.lang.Object
From interface io.reactivex.FlowableSubscriber
From interface org.reactivestreams.Publisher
From interface org.reactivestreams.Subscriber

Public Methods

public static AsyncProcessor<T> create ()

Creates a new AsyncProcessor.

Returns
  • the new AsyncProcessor instance

public Throwable getThrowable ()

Returns the error that caused the Subject to terminate or null if the Subject hasn't terminated yet.

The method is thread-safe.

Returns
  • the error that caused the Subject to terminate or null if the Subject hasn't terminated yet

public T getValue ()

Returns a single value the Subject currently has or null if no such value exists.

The method is thread-safe.

Returns
  • a single value the Subject currently has or null if no such value exists

public T[] getValues (T[] array)

Returns a typed array containing a snapshot of all values of the Subject.

The method follows the conventions of Collection.toArray by setting the array element after the last value to null (if the capacity permits).

The method is thread-safe.

Parameters
array the target array to copy values into if it fits
Returns
  • the given array if the values fit into it or a new array containing all values

public Object[] getValues ()

Returns an Object array containing snapshot all values of the Subject.

The method is thread-safe.

Returns
  • the array containing the snapshot of all values of the Subject

public boolean hasComplete ()

Returns true if the subject has reached a terminal state through a complete event.

The method is thread-safe.

Returns
  • true if the subject has reached a terminal state through a complete event

public boolean hasSubscribers ()

Returns true if the subject has subscribers.

The method is thread-safe.

Returns
  • true if the subject has subscribers

public boolean hasThrowable ()

Returns true if the subject has reached a terminal state through an error event.

The method is thread-safe.

Returns
  • true if the subject has reached a terminal state through an error event

public boolean hasValue ()

Returns true if the subject has any value.

The method is thread-safe.

Returns
  • true if the subject has any value

public void onComplete ()

public void onError (Throwable t)

public void onNext (T t)

public void onSubscribe (Subscription s)

Protected Methods

protected void subscribeActual (Subscriber<? super T> s)

Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic.

There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber.

Parameters
s the incoming Subscriber, never null