Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Created August 19, 2018 13:35
Show Gist options
  • Save anitaa1990/07f27f8b0a164355255237ea0120bc0c to your computer and use it in GitHub Desktop.
Save anitaa1990/07f27f8b0a164355255237ea0120bc0c to your computer and use it in GitHub Desktop.
Completable.create(new CompletableOnSubscribe() {
@Override
public void subscribe(CompletableEmitter emitter) {
Thread.sleep(1000);
emitter.onComplete();
}
})
.subscribeOn(Schedulers.io())
.subscribe(new CompletableObserver() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onComplete() {
System.out.println("onComplete is called");
}
@Override
public void onError(Throwable e) {
System.out.println("onError is called" + e.getMessage());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment