felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1463767 - in /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager: AbstractComponentManager.java ComponentFactoryImpl.java DependencyManager.java ImmediateComponentManager.java ServiceFactoryComponentManager.java
Date Tue, 02 Apr 2013 21:50:31 GMT
Author: djencks
Date: Tue Apr  2 21:50:30 2013
New Revision: 1463767

URL: http://svn.apache.org/r1463767
Log:
FELIX-4011 serviceFactoryCM can't expose a being-constructed object through getService, since
getService is only called once per bundle.  Also fix a method name

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java?rev=1463767&r1=1463766&r2=1463767&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
Tue Apr  2 21:50:30 2013
@@ -851,7 +851,7 @@ public abstract class AbstractComponentM
         m_dependenciesCollected = false;
     }
 
-    abstract <T> void update( DependencyManager<S, T> dependencyManager, RefPair<T>
refPair, int trackingCount );
+    abstract <T> void invokeUpdatedMethod( DependencyManager<S, T> dependencyManager,
RefPair<T> refPair, int trackingCount );
 
     abstract <T> void invokeBindMethod( DependencyManager<S, T> dependencyManager,
RefPair<T> refPair, int trackingCount );
 

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java?rev=1463767&r1=1463766&r2=1463767&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
Tue Apr  2 21:50:30 2013
@@ -278,7 +278,7 @@ public class ComponentFactoryImpl<S> ext
         return true;
     }
 
-    <T> void update( DependencyManager<S, T> dependencyManager, RefPair<T>
ref, int trackingCount )
+    <T> void invokeUpdatedMethod( DependencyManager<S, T> dependencyManager,
RefPair<T> ref, int trackingCount )
     {
     }
 

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java?rev=1463767&r1=1463766&r2=1463767&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
Tue Apr  2 21:50:30 2013
@@ -358,7 +358,7 @@ public class DependencyManager<S, T> imp
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} MultipleDynamic
modified {2} (enter)", new Object[] {getName(), trackingCount, serviceReference}, null );
             if (isActive())
             {
-                m_componentManager.update( DependencyManager.this, refPair, trackingCount
);
+                m_componentManager.invokeUpdatedMethod( DependencyManager.this, refPair,
trackingCount );
             }
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} MultipleDynamic
modified {2} (exit)", new Object[] {getName(), trackingCount, serviceReference}, null );
             tracked( trackingCount );
@@ -484,7 +484,7 @@ public class DependencyManager<S, T> imp
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} MultipleStaticGreedy
modified {2} (enter)", new Object[] {getName(), trackingCount, serviceReference}, null );
             if (isActive())
             {
-                m_componentManager.update( DependencyManager.this, refPair, trackingCount
);
+                m_componentManager.invokeUpdatedMethod( DependencyManager.this, refPair,
trackingCount );
             }
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} MultipleStaticGreedy
modified {2} (exit)", new Object[] {getName(), trackingCount, serviceReference}, null );
             tracked( trackingCount );
@@ -571,7 +571,7 @@ public class DependencyManager<S, T> imp
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} MultipleStaticReluctant
modified {2} (enter)", new Object[] {getName(), trackingCount, serviceReference}, null );
             if (isActive())
             {
-                m_componentManager.update( DependencyManager.this, refPair, trackingCount
);
+                m_componentManager.invokeUpdatedMethod( DependencyManager.this, refPair,
trackingCount );
             }
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} MultipleStaticReluctant
modified {2} (exit)", new Object[] {getName(), trackingCount, serviceReference}, null );
             tracked( trackingCount );
@@ -730,7 +730,7 @@ public class DependencyManager<S, T> imp
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} SingleDynamic
modified {2} (enter)", new Object[] {getName(), trackingCount, serviceReference}, null );
             if (isActive())
             {
-                m_componentManager.update( DependencyManager.this, refPair, trackingCount
);
+                m_componentManager.invokeUpdatedMethod( DependencyManager.this, refPair,
trackingCount );
             }
             this.trackingCount = trackingCount;
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} SingleDynamic
modified {2} (exit)", new Object[] {getName(), trackingCount, serviceReference}, null );
@@ -886,7 +886,7 @@ public class DependencyManager<S, T> imp
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} SingleStatic
modified {2} (enter)", new Object[] {getName(), trackingCount, serviceReference}, null );
             if ( isActive() )
             {
-                m_componentManager.update( DependencyManager.this, refPair, trackingCount
);
+                m_componentManager.invokeUpdatedMethod( DependencyManager.this, refPair,
trackingCount );
             }
             this.trackingCount = trackingCount;
             m_componentManager.log( LogService.LOG_DEBUG, "dm {0} tracking {1} SingleStatic
modified {2} (exit)", new Object[] {getName(), trackingCount, serviceReference}, null );

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java?rev=1463767&r1=1463766&r2=1463767&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
Tue Apr  2 21:50:30 2013
@@ -360,7 +360,7 @@ public class ImmediateComponentManager<S
         return Active.getInstance();
     }
 
-    <T> void update( DependencyManager<S, T> dependencyManager, RefPair<T>
refPair, int trackingCount )
+    <T> void invokeUpdatedMethod( DependencyManager<S, T> dependencyManager,
RefPair<T> refPair, int trackingCount )
     {
         final S impl = ( m_tmpImplementationObject != null ) ? m_tmpImplementationObject
: m_implementationObject;
         dependencyManager.invokeUpdatedMethod( impl, refPair, trackingCount );

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java?rev=1463767&r1=1463766&r2=1463767&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
Tue Apr  2 21:50:30 2013
@@ -48,12 +48,6 @@ public class ServiceFactoryComponentMana
     // service instances
     private IdentityHashMap<S, BundleComponentContext> serviceContexts = new IdentityHashMap<S,
BundleComponentContext>();
 
-    // pseudo map of implementation objects to be used for service
-    // binding while calling the activate method. The map's keys and values
-    // are just the implementation objects. The objects will only be
-    // contained while the activate method is being called.
-    private IdentityHashMap<S, BundleComponentContext> tmpImplementationObjects = new
IdentityHashMap<S, BundleComponentContext>();
-
     /**
      * @param activator BundleComponentActivator for this DS implementation
 	 * @param componentHolder ComponentHolder for configuration management
@@ -148,15 +142,13 @@ public class ServiceFactoryComponentMana
             public void presetImplementationObject( S implementationObject )
             {
                 serviceContext.setImplementationObject( implementationObject );
-                tmpImplementationObjects.put( implementationObject, serviceContext );
+                serviceContexts.put( implementationObject, serviceContext );
 
             }
 
 
             public void setImplementationObject( S implementationObject )
             {
-                serviceContexts.put( implementationObject, serviceContext );
-                tmpImplementationObjects.remove( implementationObject );
 
                 // if this is the first use of this component, switch to ACTIVE state
                 if ( getState() == STATE_REGISTERED )
@@ -168,7 +160,7 @@ public class ServiceFactoryComponentMana
 
             public void resetImplementationObject( S implementationObject )
             {
-                tmpImplementationObjects.remove( implementationObject );
+                serviceContexts.remove( implementationObject );
                 serviceContext.setImplementationObject( null );
             }
 
@@ -209,23 +201,19 @@ public class ServiceFactoryComponentMana
         }
     }
 
-    <T> void update( DependencyManager<S, T> dependencyManager, RefPair<T>
refPair, int trackingCount )
+    <T> void invokeBindMethod( DependencyManager<S, T> dependencyManager, RefPair<T>
refPair, int trackingCount )
     {
         for ( S implementationObject : serviceContexts.keySet() )
         {
-            dependencyManager.invokeUpdatedMethod( implementationObject, refPair, trackingCount
);
+            dependencyManager.invokeBindMethod( implementationObject, refPair, trackingCount
);
         }
     }
 
-    <T> void invokeBindMethod( DependencyManager<S, T> dependencyManager, RefPair<T>
refPair, int trackingCount )
+    <T> void invokeUpdatedMethod( DependencyManager<S, T> dependencyManager,
RefPair<T> refPair, int trackingCount )
     {
         for ( S implementationObject : serviceContexts.keySet() )
         {
-            dependencyManager.invokeBindMethod( implementationObject, refPair, trackingCount
);
-        }
-        for ( S implementationObject : tmpImplementationObjects.keySet() )
-        {
-            dependencyManager.invokeBindMethod( implementationObject, refPair, trackingCount
);
+            dependencyManager.invokeUpdatedMethod( implementationObject, refPair, trackingCount
);
         }
     }
 
@@ -235,10 +223,6 @@ public class ServiceFactoryComponentMana
         {
             dependencyManager.invokeUnbindMethod( implementationObject, oldRefPair, trackingCount
);
         }
-        for ( S implementationObject : tmpImplementationObjects.keySet() )
-        {
-            dependencyManager.invokeUnbindMethod( implementationObject, oldRefPair, trackingCount
);
-        }
     }
 
     protected MethodResult invokeModifiedMethod()
@@ -252,13 +236,6 @@ public class ServiceFactoryComponentMana
                     new ActivateMethod.ActivatorParameter( componentContext, -1 ), MethodResult.VOID,
this );
 
         }
-        for ( BundleComponentContext componentContext : tmpImplementationObjects.values()
)
-        {
-            Object instance = componentContext.getInstance();
-            result = modifiedMethod.invoke( instance,
-                    new ActivateMethod.ActivatorParameter( componentContext, -1 ), MethodResult.VOID,
this );
-
-        }
         return result;
     }
 



Mime
View raw message