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

Merge internal changes #915

Merged

Commits on Apr 21, 2015

  1. Add a default value and make it true for dagger & guice MapKey.

    -------------
    Created by MOE: http://code.google.com/p/moe-java
    MOE_MIGRATED_REVID=89998087
    sameb committed Apr 21, 2015
    Configuration menu
    Copy the full SHA
    6c85843 View commit details
    Browse the repository at this point in the history
  2. Implement more granular locks for a Singleton scope in Guice.

    Now when you can create two independent singletons using
    the same injector in different threads.
    This make it easy to create scopes creating singletons using
    thread pools with all the concurrency being done by Guice.
    As a nice side effect Singleton scope is no longer treated
    specially in Guice codebase.
    
    The obvious problem to solve is potential deadlocks:
    A requires B, B requires C, C requires A where all are
    singletons and all are created simultaneously.
    It's impossible to detect this deadlock using information
    within one thread, so we have to have a shared storage.
    
    An idea is to have a map of creators' locks and a map
    of which threads are waiting for other singletons to be created.
    Using this information circular dependencies are trivially
    discovered within O(N) where N is a number of concurrent threads.
    
    Important to not that no other deadlock scenarios within
    Guice code is introduced as Guice does not expose any
    other scopes that can span several threads.
    
    Now it would be possible for
    client code to deadlock on itself with two lazy singletons
    calling each other's providers during creation.
    This is deemed as a non-issue as it is up to the client
    to write a thread-safe code.
    -------------
    Created by MOE: http://code.google.com/p/moe-java
    MOE_MIGRATED_REVID=91610630
    timofeyb authored and sameb committed Apr 21, 2015
    Configuration menu
    Copy the full SHA
    5e6c933 View commit details
    Browse the repository at this point in the history
  3. Update dagger-adapter to depend on dagger-2.0 (and swap in the up-to-…

    …date api jar for the ant build)
    
    -------------
    Created by MOE: http://code.google.com/p/moe-java
    MOE_MIGRATED_REVID=91679331
    cgruber authored and sameb committed Apr 21, 2015
    Configuration menu
    Copy the full SHA
    3809a81 View commit details
    Browse the repository at this point in the history