The javadoc of Disposable.dispose() states:
Dispose the resource, the operation should be idempotent.
The one of Cancellable.cancel() states:
Cancel the action or free a resource.
It seems like these interfaces somehow overlap, what's the difference? when should we set a Disposable on an emitter vs a Cancellable ?
It depends on what type of resource you have. If it already implements Disposable then use setDisposable. If you have something general which can also throw such as a java.io.Closeable then use setCancellable.
I'm closing this issue due to inactivity. If you have further input on the issue, don't hesitate to reopen this issue or post a new one.
Is this both called when you do unsubscribe()?
No. Per the docs, one replaces the other.
On Sun, Mar 26, 2017, 9:27 PM Gabor Varadi notifications@github.com wrote:
Is this both called when you do unsubscribe()?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ReactiveX/RxJava/issues/4812#issuecomment-289333476,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEdKJpxRmfWeL6E7ixEV2OX1gtGmGks5rpxCbgaJpZM4KqXLr
.
Most helpful comment
It depends on what type of resource you have. If it already implements
Disposablethen usesetDisposable. If you have something general which can also throw such as ajava.io.Closeablethen usesetCancellable.