felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1424315 - in /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager: DependencyManager.java ImmediateComponentManager.java ServiceFactoryComponentManager.java
Date Thu, 20 Dec 2012 04:53:22 GMT
Author: djencks
Date: Thu Dec 20 04:53:22 2012
New Revision: 1424315

URL: http://svn.apache.org/viewvc?rev=1424315&view=rev
Log:
FELIX-3729 cleanup event interval tracking when component instance is deleted

Modified:
    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/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java?rev=1424315&r1=1424314&r2=1424315&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
Thu Dec 20 04:53:22 2012
@@ -1345,6 +1345,10 @@ public class DependencyManager<S, T> imp
         latch.countDown();
     }
 
+    void cleanup( S componentInstance)
+    {
+        edgeInfoMap.remove( componentInstance );
+    }
 
     public void invokeBindMethodLate( final ServiceReference<T> ref, int trackingCount
)
     {

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=1424315&r1=1424314&r2=1424315&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
Thu Dec 20 04:53:22 2012
@@ -164,9 +164,11 @@ public class ImmediateComponentManager<S
         }
         if ( m_implementationObject != null )
         {
-            disposeImplementationObject( m_implementationObject, m_componentContext, reason
);
+            S implementationObject = m_implementationObject;
+            disposeImplementationObject( implementationObject, m_componentContext, reason
);
             m_useCount.set( 0 );
             m_implementationObject = null;
+            cleanupImplementationObject( implementationObject );
             log( LogService.LOG_DEBUG, "Unset implementation object for component {0} in
deleteComponent for reason {1}", new Object[] { getName(), reason },  null );
             m_componentContext = null;
             m_properties = null;
@@ -335,6 +337,16 @@ public class ImmediateComponentManager<S
         // nothing to do, we keep no references on per-Bundle services
     }
 
+    protected void cleanupImplementationObject( Object implementationObject )
+    {
+
+        for ( DependencyManager md: getReversedDependencyManagers() )
+        {
+            md.cleanup( implementationObject );
+        }
+
+    }
+
     State getSatisfiedState()
     {
         return Registered.getInstance();

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=1424315&r1=1424314&r2=1424315&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
Thu Dec 20 04:53:22 2012
@@ -89,8 +89,9 @@ public class ServiceFactoryComponentMana
         for (Iterator i = serviceContexts.values().iterator(); i.hasNext(); )
         {
             BundleComponentContext componentContext = ( BundleComponentContext ) i.next();
-            i.remove();
             disposeImplementationObject( componentContext.getInstance(), componentContext,
reason );
+            i.remove();
+            cleanupImplementationObject( componentContext.getInstance() );
             log( LogService.LOG_DEBUG, "Unset implementation object for component {0} in
deleteComponent", new Object[] { getName() },  null );
         }
     }
@@ -195,10 +196,11 @@ public class ServiceFactoryComponentMana
         // When the ungetServiceMethod is called, the implementation object must be deactivated
         // private ComponentContext and implementation instances
         final ComponentContext serviceContext;
-        serviceContext = ( ComponentContext ) serviceContexts.remove( service );
+        serviceContext = serviceContexts.get( service );
 
         disposeImplementationObject( service, serviceContext, ComponentConstants.DEACTIVATION_REASON_DISPOSED
);
-
+        serviceContexts.remove( service );
+        cleanupImplementationObject( service );
         // if this was the last use of the component, go back to REGISTERED state
         if ( serviceContexts.isEmpty() && getState() == STATE_ACTIVE )
         {



Mime
View raw message