Skip to content

Instantly share code, notes, and snippets.

@tcw165
Last active April 30, 2018 02:20
Show Gist options
  • Select an option

  • Save tcw165/8211ff20c89da775894428f4287db3eb to your computer and use it in GitHub Desktop.

Select an option

Save tcw165/8211ff20c89da775894428f4287db3eb to your computer and use it in GitHub Desktop.
public final class ConsumerSingleObserver<T>
extends AtomicReference<Disposable>
implements SingleObserver<T>,
Disposable,
LambdaConsumerIntrospection {
// ...
@Override
public void onSubscribe(Disposable d) {
DisposableHelper.setOnce(this, d);
}
@Override
public void onSuccess(T value) {
lazySet(DisposableHelper.DISPOSED);
try {
onSuccess.accept(value);
} catch (Throwable ex) {
// ...
}
}
@Override
public void dispose() {
DisposableHelper.dispose(this);
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment