Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve request cancelation handling. #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 27, 2017

  1. Improve request cancelation handling.

    - Provide stronger thread safety guarantees by locking access to any
    variable which can be mutated during the processing of a request (i.e.
    by the CacheDispatcher/NetworkDispatcher threads) and dispatching
    response callbacks while holding the same lock that is held when
    setting mCanceled. Unfortunately there's not much we can do about
    alternative ResponseDelivery mechanisms, which are hopefully rare.
    
    - Add a cancel listener interface and use it to prevent RequestFuture
    from blocking for the complete timeout (or indefinitely) if a request
    is canceled.
    
    - Since listeners are often Android component classes like Activitys,
    clear them upon cancellation. Unfortunately, this must be done in each
    Request subclass to work, assuming the subclass follows the standard
    pattern of holding the response listener as a member. But this enables
    concerned apps to resolve this leak.
    
    Fixes google#15
    Fixes google#85
    jpd236 committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    9f3cb5e View commit details
    Browse the repository at this point in the history