GitHub
2015-04-21 00:51:14 UTC
Branch: refs/heads/moe_writing_branch_from_156c8cc762fab971efb727c7ab107fa243be2fc9
Home: https://github.com/google/guice
Commit: 6b4bbe9123c0ba6b362978cda6f6714c83f154c4
https://github.com/google/guice/commit/6b4bbe9123c0ba6b362978cda6f6714c83f154c4
Author: sameb <***@google.com>
Date: 2015-04-20 (Mon, 20 Apr 2015)
Changed paths:
M extensions/multibindings/src/com/google/inject/multibindings/MapKey.java
Log Message:
-----------
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
Commit: 6986d188358d2aa60ba2cce93c86438c35c5e0eb
https://github.com/google/guice/commit/6986d188358d2aa60ba2cce93c86438c35c5e0eb
Author: timofeyb <***@google.com>
Date: 2015-04-20 (Mon, 20 Apr 2015)
Changed paths:
M core/src/com/google/inject/internal/BindingProcessor.java
M core/src/com/google/inject/internal/BoundProviderFactory.java
M core/src/com/google/inject/internal/ConstructionContext.java
M core/src/com/google/inject/internal/ConstructorBindingImpl.java
M core/src/com/google/inject/internal/ConstructorInjector.java
A core/src/com/google/inject/internal/CycleDetectingLock.java
M core/src/com/google/inject/internal/DelegatingInvocationHandler.java
M core/src/com/google/inject/internal/Errors.java
M core/src/com/google/inject/internal/InheritingState.java
M core/src/com/google/inject/internal/InjectorImpl.java
M core/src/com/google/inject/internal/InternalContext.java
M core/src/com/google/inject/internal/InternalFactoryToInitializableAdapter.java
M core/src/com/google/inject/internal/ProvidedByInternalFactory.java
M core/src/com/google/inject/internal/ProviderInternalFactory.java
M core/src/com/google/inject/internal/Scoping.java
M core/src/com/google/inject/internal/SingletonScope.java
M core/src/com/google/inject/internal/State.java
M core/test/com/google/inject/ScopesTest.java
A core/test/com/google/inject/internal/CycleDetectingLockTest.java
Log Message:
-----------
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
Compare: https://github.com/google/guice/compare/6b4bbe9123c0^...6986d188358d
Home: https://github.com/google/guice
Commit: 6b4bbe9123c0ba6b362978cda6f6714c83f154c4
https://github.com/google/guice/commit/6b4bbe9123c0ba6b362978cda6f6714c83f154c4
Author: sameb <***@google.com>
Date: 2015-04-20 (Mon, 20 Apr 2015)
Changed paths:
M extensions/multibindings/src/com/google/inject/multibindings/MapKey.java
Log Message:
-----------
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
Commit: 6986d188358d2aa60ba2cce93c86438c35c5e0eb
https://github.com/google/guice/commit/6986d188358d2aa60ba2cce93c86438c35c5e0eb
Author: timofeyb <***@google.com>
Date: 2015-04-20 (Mon, 20 Apr 2015)
Changed paths:
M core/src/com/google/inject/internal/BindingProcessor.java
M core/src/com/google/inject/internal/BoundProviderFactory.java
M core/src/com/google/inject/internal/ConstructionContext.java
M core/src/com/google/inject/internal/ConstructorBindingImpl.java
M core/src/com/google/inject/internal/ConstructorInjector.java
A core/src/com/google/inject/internal/CycleDetectingLock.java
M core/src/com/google/inject/internal/DelegatingInvocationHandler.java
M core/src/com/google/inject/internal/Errors.java
M core/src/com/google/inject/internal/InheritingState.java
M core/src/com/google/inject/internal/InjectorImpl.java
M core/src/com/google/inject/internal/InternalContext.java
M core/src/com/google/inject/internal/InternalFactoryToInitializableAdapter.java
M core/src/com/google/inject/internal/ProvidedByInternalFactory.java
M core/src/com/google/inject/internal/ProviderInternalFactory.java
M core/src/com/google/inject/internal/Scoping.java
M core/src/com/google/inject/internal/SingletonScope.java
M core/src/com/google/inject/internal/State.java
M core/test/com/google/inject/ScopesTest.java
A core/test/com/google/inject/internal/CycleDetectingLockTest.java
Log Message:
-----------
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
Compare: https://github.com/google/guice/compare/6b4bbe9123c0^...6986d188358d
--
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice-dev+***@googlegroups.com.
To post to this group, send email to google-guice-***@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice-dev+***@googlegroups.com.
To post to this group, send email to google-guice-***@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.