Top Description Fields Constructors Methods
io.reactivex.internal.observers

public final Class BlockingMultiObserver<T>

extends CountDownLatch
implements SingleObserver<T>, CompletableObserver, MaybeObserver<T>
Class Inheritance
All Implemented Interfaces
io.reactivex.MaybeObserver, io.reactivex.CompletableObserver, io.reactivex.SingleObserver
Type Parameters
<T>
the value type
Imports
java.util.concurrent.*, io.reactivex.*, io.reactivex.disposables.Disposable, io.reactivex.internal.util.*

A combined Observer that awaits the success or error signal via a CountDownLatch.

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean
pack-priv Throwable
pack-priv Disposable
pack-priv T

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the observer terminated in time, false otherwise
blockingAwait
(long
the timeout value
timeout
,
TimeUnit
the time unit
unit
)

Block until the observer terminates and return true; return false if the wait times out.

public T

Returns:

the value received or null if no value received
blockingGet
()

Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (null if none).

public T

Returns:

the value received or defaultValue if no value received
blockingGet
(T
the default value to return if no value was received
defaultValue
)

Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (the defaultValue if none).

public Throwable

Returns:

the error received or null
blockingGetError
()

Block until the latch is counted down and return the error received or null if no error happened.

public Throwable

Returns:

the error received or null
blockingGetError
(long
the timeout value
timeout
,
TimeUnit
the time unit
unit
)

Block until the latch is counted down and return the error received or when the wait is interrupted or times out, null otherwise.

pack-priv void
public void
onComplete()

Implements io.reactivex.CompletableObserver.onComplete, io.reactivex.MaybeObserver.onComplete.

Called once the deferred computation completes normally.
public void
onError(Throwable
the exception encountered by the Single
e
)

Implements io.reactivex.SingleObserver.onError, io.reactivex.CompletableObserver.onError, io.reactivex.MaybeObserver.onError.

Notifies the SingleObserver that the Single has experienced an error condition.
public void
onSubscribe(Disposable
the Disposable instance whose Disposable#dispose() can be called anytime to cancel the connection
d
)

Implements io.reactivex.SingleObserver.onSubscribe, io.reactivex.CompletableObserver.onSubscribe, io.reactivex.MaybeObserver.onSubscribe.

Provides the SingleObserver with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from within onSubscribe(Disposable) itself) and asynchronous manner.
public void
onSuccess(T
the item emitted by the Single
value
)

Implements io.reactivex.SingleObserver.onSuccess, io.reactivex.MaybeObserver.onSuccess.

Notifies the SingleObserver with a single item and that the Single has finished sending push-based notifications.
Inherited from java.util.concurrent.CountDownLatch:
awaitawaitcountDowngetCounttoString

Field Detail

cancelledback to summary
pack-priv volatile boolean cancelled
errorback to summary
pack-priv Throwable error
upstreamback to summary
pack-priv Disposable upstream
valueback to summary
pack-priv T value

Constructor Detail

BlockingMultiObserverback to summary
public BlockingMultiObserver()

Method Detail

blockingAwaitback to summary
public boolean blockingAwait(long timeout, TimeUnit unit)

Block until the observer terminates and return true; return false if the wait times out.

Parameters
timeout:long

the timeout value

unit:TimeUnit

the time unit

Returns:boolean

true if the observer terminated in time, false otherwise

blockingGetback to summary
public T blockingGet()

Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (null if none).

Returns:T

the value received or null if no value received

blockingGetback to summary
public T blockingGet(T defaultValue)

Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (the defaultValue if none).

Parameters
defaultValue:T

the default value to return if no value was received

Returns:T

the value received or defaultValue if no value received

blockingGetErrorback to summary
public Throwable blockingGetError()

Block until the latch is counted down and return the error received or null if no error happened.

Returns:Throwable

the error received or null

blockingGetErrorback to summary
public Throwable blockingGetError(long timeout, TimeUnit unit)

Block until the latch is counted down and return the error received or when the wait is interrupted or times out, null otherwise.

Parameters
timeout:long

the timeout value

unit:TimeUnit

the time unit

Returns:Throwable

the error received or null

disposeback to summary
pack-priv void dispose()
onCompleteback to summary
public void onComplete()

Implements io.reactivex.CompletableObserver.onComplete, io.reactivex.MaybeObserver.onComplete.

Doc from io.reactivex.CompletableObserver.onComplete.

Called once the deferred computation completes normally.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements io.reactivex.SingleObserver.onError, io.reactivex.CompletableObserver.onError, io.reactivex.MaybeObserver.onError.

Doc from io.reactivex.SingleObserver.onError.

Notifies the SingleObserver that the Single has experienced an error condition.

If the Single calls this method, it will not thereafter call onSuccess.

Parameters
e:Throwable

the exception encountered by the Single

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Disposable d)

Implements io.reactivex.SingleObserver.onSubscribe, io.reactivex.CompletableObserver.onSubscribe, io.reactivex.MaybeObserver.onSubscribe.

Doc from io.reactivex.SingleObserver.onSubscribe.

Provides the SingleObserver with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from within onSubscribe(Disposable) itself) and asynchronous manner.

Parameters
d:Disposable

the Disposable instance whose Disposable#dispose() can be called anytime to cancel the connection

Annotations
@Override
onSuccessback to summary
public void onSuccess(T value)

Implements io.reactivex.SingleObserver.onSuccess, io.reactivex.MaybeObserver.onSuccess.

Doc from io.reactivex.SingleObserver.onSuccess.

Notifies the SingleObserver with a single item and that the Single has finished sending push-based notifications.

The Single will not call this method if it calls onError.

Parameters
value:T

the item emitted by the Single

Annotations
@Override