use of io.reactivex.rxjava3.disposables.Disposable in project Signal-Android by WhisperSystems.
the class SignalWebSocket method getWebSocket.
private synchronized WebSocketConnection getWebSocket() throws WebSocketUnavailableException {
if (!canConnect) {
throw new WebSocketUnavailableException();
}
if (webSocket == null || webSocket.isDead()) {
webSocketStateDisposable.dispose();
webSocket = webSocketFactory.createWebSocket();
webSocketStateDisposable = new CompositeDisposable();
Disposable state = webSocket.connect().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(webSocketState::onNext);
webSocketStateDisposable.add(state);
}
return webSocket;
}
use of io.reactivex.rxjava3.disposables.Disposable in project RxJava by ReactiveX.
the class FlowableInterval method subscribeActual.
@Override
public void subscribeActual(Subscriber<? super Long> s) {
IntervalSubscriber is = new IntervalSubscriber(s);
s.onSubscribe(is);
Scheduler sch = scheduler;
if (sch instanceof TrampolineScheduler) {
Worker worker = sch.createWorker();
is.setResource(worker);
worker.schedulePeriodically(is, initialDelay, period, unit);
} else {
Disposable d = sch.schedulePeriodicallyDirect(is, initialDelay, period, unit);
is.setResource(d);
}
}
use of io.reactivex.rxjava3.disposables.Disposable in project RxJava by ReactiveX.
the class ObservableIntervalRange method subscribeActual.
@Override
public void subscribeActual(Observer<? super Long> observer) {
IntervalRangeObserver is = new IntervalRangeObserver(observer, start, end);
observer.onSubscribe(is);
Scheduler sch = scheduler;
if (sch instanceof TrampolineScheduler) {
Worker worker = sch.createWorker();
is.setResource(worker);
worker.schedulePeriodically(is, initialDelay, period, unit);
} else {
Disposable d = sch.schedulePeriodicallyDirect(is, initialDelay, period, unit);
is.setResource(d);
}
}
use of io.reactivex.rxjava3.disposables.Disposable in project RxJava by ReactiveX.
the class FlowableTimer method subscribeActual.
@Override
public void subscribeActual(Subscriber<? super Long> s) {
TimerSubscriber ios = new TimerSubscriber(s);
s.onSubscribe(ios);
Disposable d = scheduler.scheduleDirect(ios, delay, unit);
ios.setResource(d);
}
use of io.reactivex.rxjava3.disposables.Disposable in project RxJava by ReactiveX.
the class FlowableRefCount method timeout.
void timeout(RefConnection rc) {
synchronized (this) {
if (rc.subscriberCount == 0 && rc == connection) {
connection = null;
Disposable connectionObject = rc.get();
DisposableHelper.dispose(rc);
if (connectionObject == null) {
rc.disconnectedEarly = true;
} else {
source.reset();
}
}
}
}
Aggregations