You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it expected behavior that switchIfEmpty may interrupt its thread?
Problem
Within a switchIfEmpty block, I'm using Completable.blockingAwait(long, TimeUnit) which throws an InterruptedException upon entry because the current thread's interrupt flag is raised.
Analysis
I ran the debugger and stepped through this scenario. SubscriptionArbiter.setSubscription cancels the previous observable before switching to the next. Disposing the observable is done with a call to ScheduledThreadPoolExecutor.ScheduledFutureTask.cancel(true) which then interrupts the thread.
The text was updated successfully, but these errors were encountered:
jozuasijsling
changed the title
Observable.switchIfEmpty interrupts thread on 2.x
Observable.switchIfEmpty interrupts thread
May 26, 2017
jozuasijsling
changed the title
Observable.switchIfEmpty interrupts thread
Flowable.switchIfEmpty interrupts thread
May 26, 2017
Please try with a newer version as the unnecessary self-interrupt behavior has been already fixed: v2.0.8 via PR #5207.
Also the test case you showed doesn't contain any Scheduler (or an alternate Observable in fact to switch to) thus unless some other test leaves the test thread in an interrupted state, this test should pass.
Is it expected behavior that
switchIfEmpty
may interrupt its thread?Problem
Within a
switchIfEmpty
block, I'm usingCompletable.blockingAwait(long, TimeUnit)
which throws anInterruptedException
upon entry because the current thread's interrupt flag is raised.Analysis
I ran the debugger and stepped through this scenario.
SubscriptionArbiter.setSubscription
cancels the previous observable before switching to the next. Disposing the observable is done with a call toScheduledThreadPoolExecutor.ScheduledFutureTask.cancel(true)
which then interrupts the thread.The text was updated successfully, but these errors were encountered: