Reactive-Billing
Reactive-Billing copied to clipboard
isBillingSupported blocks scheduler indefinitely
The answer to the question in BaseObservable
:
// freeze the current RX thread until service is connected
// because bindService() will call the connection callback on the main thread
// we want to get back on the current RX thread
ReactiveBillingLogger.log("Acquire semaphore until service is ready (thread %s)", Thread.currentThread().getName());
semaphore.acquireUninterruptibly();
// once the semaphore is released
// it means that the service is connected and available
//TODO: what happens if the service is never connected?
deliverBillingService(subscriber);
seems to be "it blocks the scheduler thread forever". Ideally there'd be a way to use a timeout operator here, is there a reason that wouldn't work?
That would be better indeed. I'm also planning to invest more time into this threading issue, because current "blocking thread" solution does not seem to be the best solution.
Any update on this?