Does CompositeDisposable.dispose() Interrupt Tasks.await() in an Rx Subscription?

66 Views Asked by At

Is it normal for Tasks.await() from com.google.android.gms.tasks to be interrupted when CompositeDisposable.dispose() is called in an Rx subscription? I thought Rx operations run to completion by default.

In other words Tasks.await() throws InterruptedException when the Rx subscription is disposed, I don't understand how and why there are not information about this.

addSubscription(Completable.create(emitter -> {
        try {
            //some operation with Tasks.await()
        } catch (ExecutionException e) {
            e.printStackTrace();
            if (!emitter.isDisposed()){
                emitter.onError(e);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
            if (!emitter.isDisposed()){
                emitter.onError(e);
            }
        }
        
        if (!emitter.isDisposed()){
            emitter.onComplete();
        }
    }).subscribeOn(getIoScheduler()).observeOn(getMainThreadScheduler()).subscribe(() -> {
        //on complete
    },throwable -> {
        throwable.printStackTrace();
    }));
0

There are 0 best solutions below