Open
Description
RequestFuture#get waits for either onResponse or onErrorResponse to be called before attempting to return a result. However, if a request is cancelled, by design, neither callback will be executed. This means get() will block forever (or until the user-specified timeout, if one is given).
Proposal to fix:
- Add an optional CancelListener that can be set on a request
- Have cancel() only set mCanceled = true when called from the main thread, and queue a runnable to do so otherwise
- Call the cancel listener when setting mCanceled = true (on the main thread)
- Have RequestFuture implement CancelListener and set itself as the listener in setRequest, and call notify() in the listener.
- Ensure we use setRequest everywhere we use RequestFuture so it is cancellable
Metadata
Metadata
Assignees
Labels
No labels