RxJava



rx.plugins
Class DebugNotificationListener<C>

java.lang.Object
  extended by rx.plugins.DebugNotificationListener<C>
Type Parameters:
C - Context type that is returned from start and passed to either complete or error.

public abstract class DebugNotificationListener<C>
extends java.lang.Object

Subclasses of this are passed into the constructor of DebugHook to receive notification about all activity in Rx.

See Also:
DebugHook

Constructor Summary
DebugNotificationListener()
           
 
Method Summary
 void complete(C context)
          After the actual operations has completed from DebugNotificationListener.start(DebugNotification) this is invoked
 void error(C context, java.lang.Throwable e)
          After the actual operations has thrown an exception from DebugNotificationListener.start(DebugNotification) this is invoked
<T> T
onNext(DebugNotification<T> n)
          Override this to change the default behavior of returning the encapsulated value.
<T> C
start(DebugNotification<T> n)
          For each DebugNotification.Kind start is invoked before the actual method is invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugNotificationListener

public DebugNotificationListener()
Method Detail

onNext

public <T> T onNext(DebugNotification<T> n)
Override this to change the default behavior of returning the encapsulated value. This will only be invoked when the DebugNotification.getKind() is DebugNotification.Kind.OnNext and the value (null or not) is just about to be sent to next Observer. This can end up being called multiple times for the same value as it passes from Observable.Operator to Observable.Operator in the Observable chain.

This can be used to decorate or replace the values passed into any onNext function or just perform extra logging, metrics and other such things and pass-thru the function.

Parameters:
n - DebugNotification containing the data and context about what is happening.
Returns:

start

public <T> C start(DebugNotification<T> n)
For each DebugNotification.Kind start is invoked before the actual method is invoked.

This can be used to perform extra logging, metrics and other such things.

Parameters:
n - DebugNotification containing the data and context about what is happening.
Returns:
A contextual object that the listener can use in the #complete(C) or #error(C, Throwable) after the actual operation has ended.

complete

public void complete(C context)
After the actual operations has completed from DebugNotificationListener.start(DebugNotification) this is invoked

Parameters:
context -

error

public void error(C context,
                  java.lang.Throwable e)
After the actual operations has thrown an exception from DebugNotificationListener.start(DebugNotification) this is invoked

Parameters:
context -