protected void stopProgressLoop() { progressUpdateReactor.set(null); }
@Override public void onConnectionSubscribed() { serialSubscription.set(mtuObservable.subscribe(this, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) { // ignoring, this is expected when the connection is lost. } })); }
protected void startProgressLoop() { progressUpdateReactor.set(getProgressReactor()); }
@Override public void run() { try { start.await(); serialDisposable.set(subscription); } catch (InterruptedException e) { fail(e.getMessage()); } finally { end.countDown(); } } };
@Test public void unsubscribingWithSingleUnderlyingUnsubscribes() { Disposable underlying = mock(Disposable.class); serialDisposable.set(underlying); underlying.dispose(); verify(underlying).dispose(); }
@Test public void settingUnderlyingWhenUnsubscribedCausesImmediateUnsubscription() { serialDisposable.dispose(); Disposable underlying = mock(Disposable.class); serialDisposable.set(underlying); verify(underlying).dispose(); }
@Test public void unsubscribingTwiceDoesUnsubscribeOnce() { Disposable underlying = mock(Disposable.class); serialDisposable.set(underlying); serialDisposable.dispose(); verify(underlying).dispose(); serialDisposable.dispose(); verifyNoMoreInteractions(underlying); }
public void destroy() { if (DEBUG) Log.d(TAG, "destroy() called"); destroyPlayer(); unregisterBroadcastReceiver(); databaseUpdateReactor.clear(); progressUpdateReactor.set(null); }
@Test public void notDisposedWhenReplaced() { final Disposable underlying = mock(Disposable.class); serialDisposable.set(underlying); serialDisposable.replace(Disposables.empty()); serialDisposable.dispose(); verify(underlying, never()).dispose(); }
@Test public void getDisposableShouldReturnset() { final Disposable underlying = mock(Disposable.class); serialDisposable.set(underlying); assertSame(underlying, serialDisposable.get()); final Disposable another = mock(Disposable.class); serialDisposable.set(another); assertSame(another, serialDisposable.get()); }
ConditionalCompactorSubscriber(Subscriber<? super String> actual, long timeout, TimeUnit unit, Worker worker) { this.actual = actual; this.worker = worker; this.timeout = timeout; this.unit = unit; this.batch = new ArrayList<>(); this.wip = new AtomicInteger(); this.mas = new SerialDisposable(); this.mas.set(NO_TIMER); this.queue = new ConcurrentLinkedQueue<>(); }