forked from ReactiveX/RxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugSubscription.java
More file actions
32 lines (27 loc) · 1014 Bytes
/
DebugSubscription.java
File metadata and controls
32 lines (27 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package rx.operators;
import rx.Subscription;
import rx.plugins.DebugNotification;
import rx.plugins.DebugNotificationListener;
final class DebugSubscription<T, C> implements Subscription {
private final DebugSubscriber<T, C> debugObserver;
private DebugNotificationListener<C> listener;
DebugSubscription(DebugSubscriber<T, C> debugObserver, DebugNotificationListener<C> listener) {
this.debugObserver = debugObserver;
this.listener = listener;
}
@Override
public void unsubscribe() {
final DebugNotification<T> n = DebugNotification.<T> createUnsubscribe(debugObserver.getActual(), debugObserver.getFrom(), debugObserver.getTo());
C context = listener.start(n);
try {
debugObserver.unsubscribe();
listener.complete(context);
} catch (Throwable e) {
listener.error(context, e);
}
}
@Override
public boolean isUnsubscribed() {
return debugObserver.isUnsubscribed();
}
}