RxJava



rx.operators
Class OperationFinally

java.lang.Object
  extended by rx.operators.OperationFinally

public final class OperationFinally
extends java.lang.Object

Registers an action to be called when an Observable invokes onComplete or onError.

See also the MSDN Observable.Finally method


Constructor Summary
OperationFinally()
           
 
Method Summary
static
<T> Observable.OnSubscribeFunc<T>
finallyDo(Observable<? extends T> sequence, Action0 action)
          Call a given action when a sequence completes (with or without an exception).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationFinally

public OperationFinally()
Method Detail

finallyDo

public static <T> Observable.OnSubscribeFunc<T> finallyDo(Observable<? extends T> sequence,
                                                          Action0 action)
Call a given action when a sequence completes (with or without an exception). The returned observable is exactly as threadsafe as the source observable.

Note that "finally" is a Java reserved word and cannot be an identifier, so we use "finallyDo".

Parameters:
sequence - An observable sequence of elements
action - An action to be taken when the sequence is complete or throws an exception
Returns:
An observable sequence with the same elements as the input. After the last element is consumed (and Observer.onCompleted() has been called), or after an exception is thrown (and Observer.onError(java.lang.Throwable) has been called), the given action will be called.
See Also:
MSDN Observable.Finally method