/** * An Observable that allows to monitor the connection status of the Session. */ public Observable<State> statusChanged() { return stateController.statusObservable(); }
/** * An Observable that allows to monitor the connection status of the Session. */ public Observable<State> statusChanged() { return stateController.statusObservable(); }
/** * An Observable that allows to monitor the connection status of the Session. */ public Observable<State> statusChanged() { return stateController.statusObservable(); }
/** * Returns an observable that will be completed with a single value once the client terminates.<br> * This can be used to asynchronously wait for completion after {@link #close() close} was called. */ public Observable<Void> getTerminationObservable() { final AsyncSubject<Void> termSubject = AsyncSubject.create(); stateController.statusObservable().subscribe(new Observer<State>() { @Override public void onCompleted() { termSubject.onNext(null); termSubject.onCompleted(); } @Override public void onError(Throwable e) { termSubject.onNext(null); termSubject.onCompleted(); } @Override public void onNext(State t) { } }); return termSubject; }
/** * Returns an observable that will be completed with a single value once the client terminates.<br> * This can be used to asynchronously wait for completion after {@link #close() close} was called. */ public Observable<Void> getTerminationObservable() { final AsyncSubject<Void> termSubject = AsyncSubject.create(); stateController.statusObservable().subscribe(new Observer<State>() { @Override public void onCompleted() { termSubject.onNext(null); termSubject.onCompleted(); } @Override public void onError(Throwable e) { termSubject.onNext(null); termSubject.onCompleted(); } @Override public void onNext(State t) { } }); return termSubject; }
/** * Returns a future that will be completed once the client terminates.<br> * This can be used to wait for completion after {@link #close() close} was called. */ public Future<Void> getTerminationFuture() { final Promise<Void> p = new Promise<Void>(); stateController.statusObservable().subscribe(new Observer<State>() { @Override public void onCompleted() { p.resolve(null); } @Override public void onError(Throwable e) { p.resolve(null); } @Override public void onNext(State t) { } }); return p.getFuture(); }
/** * Returns a future that will be completed once the client terminates.<br> * This can be used to wait for completion after {@link #close() close} was called. */ public Future<Void> getTerminationFuture() { final Promise<Void> p = new Promise<Void>(); stateController.statusObservable().subscribe(new Observer<State>() { @Override public void onCompleted() { p.resolve(null); } @Override public void onError(Throwable e) { p.resolve(null); } @Override public void onNext(State t) { } }); return p.getFuture(); }