You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/03/07 22:38:14 UTC

svn commit: r1575420 - /felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/DependencyImpl.java

Author: pderop
Date: Fri Mar  7 21:38:14 2014
New Revision: 1575420

URL: http://svn.apache.org/r1575420
Log:
In changeDependency() method: invoke change if component state is instantiated (TRACKING_OPTIONAL or
INSTANTIATED_AND_WAITING_FOR_REQUIRED).
For now, I have introduced "isInstantiated" method in the ComponentContext interface, like in the old code base;
But may be this has to be cleaned or refactored ?

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/DependencyImpl.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/DependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/DependencyImpl.java?rev=1575420&r1=1575419&r2=1575420&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/DependencyImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/DependencyImpl.java Fri Mar  7 21:38:14 2014
@@ -102,18 +102,19 @@ public class DependencyImpl implements D
 		}
 	}
 
-	protected void changeDependency(Event e) {
+	protected void changeDependency(Event e) {	    
 		m_dependencies.remove(e);
 		m_dependencies.add(e);
+        if (m_change != null && m_component.isInstantiated()) {
+            // invoke change only if state is in instantiated_waiting_for_required or tracking_optional
+            invoke(m_change, e);
+        } 
 		if (m_component.isAvailable()) {
-			if (m_change != null) {
-				invoke(m_change, e);
-			} 
 			m_component.updateInstance(this);
 		}
 		m_component.handleChange();
 	}
-	
+		
 	protected void removeDependency(Event e) {
 		m_available = !(m_dependencies.contains(e) && m_dependencies.size() == 1);
 		m_component.handleChange();