onami-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r1573277 - /onami/trunk/scopes/src/main/java/org/apache/onami/scopes/ConcurrentLazySingletonScopeImpl.java
Date Sun, 02 Mar 2014 10:28:48 GMT
Author: ash2k
Date: Sun Mar  2 10:28:48 2014
New Revision: 1573277

URL: http://svn.apache.org/r1573277
Log:
Do not use Guice internal APIs

Modified:
    onami/trunk/scopes/src/main/java/org/apache/onami/scopes/ConcurrentLazySingletonScopeImpl.java

Modified: onami/trunk/scopes/src/main/java/org/apache/onami/scopes/ConcurrentLazySingletonScopeImpl.java
URL: http://svn.apache.org/viewvc/onami/trunk/scopes/src/main/java/org/apache/onami/scopes/ConcurrentLazySingletonScopeImpl.java?rev=1573277&r1=1573276&r2=1573277&view=diff
==============================================================================
--- onami/trunk/scopes/src/main/java/org/apache/onami/scopes/ConcurrentLazySingletonScopeImpl.java
(original)
+++ onami/trunk/scopes/src/main/java/org/apache/onami/scopes/ConcurrentLazySingletonScopeImpl.java
Sun Mar  2 10:28:48 2014
@@ -23,7 +23,6 @@ import com.google.inject.Key;
 import com.google.inject.Provider;
 import com.google.inject.ProvisionException;
 import com.google.inject.Scope;
-import com.google.inject.internal.CircularDependencyProxy;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -61,13 +60,24 @@ class ConcurrentLazySingletonScopeImpl
                             {
                                 T provided = creator.get();
 
-                                // don't remember proxies; these exist only to serve circular
dependencies
-                                if ( provided instanceof CircularDependencyProxy )
-                                {
-                                    return provided;
-                                }
+								Object providedOrSentinel;
+								if ( provided == null )
+								{
+									providedOrSentinel = NULL;
+								}
+								else
+								{
+									for ( Class<?> clazz : provided.getClass().getInterfaces() )
+									{
+										// don't remember proxies; these exist only to serve circular dependencies
+										if ( clazz.getName().equals("com.google.inject.internal.CircularDependencyProxy")
)
+										{
+											return provided;
+										}
+									}
+									providedOrSentinel = provided;
+								}
 
-                                Object providedOrSentinel = ( provided == null ) ? NULL :
provided;
                                 if ( ( instance != null ) && ( instance != providedOrSentinel
) )
                                 {
                                     throw new ProvisionException( "Provider was reentrant
while creating a singleton" );



Mime
View raw message