Author: clement
Date: Tue May 15 16:43:03 2012
New Revision: 1338788

URL: http://svn.apache.org/viewvc?rev=1338788&view=rev
Log:
Fix FELIX-3501. 

Store the state before its modification.

Modified:
    
felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java

Modified: 
felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java?rev=1338788&r1=1338787&r2=1338788&view=diff
==============================================================================
--- 
felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
 (original)
+++ 
felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
 Tue May 15 16:43:03 2012
@@ -522,6 +522,8 @@ public abstract class IPojoFactory imple
             m_sr = null;
         }
         stopping(); // Method called when holding the lock.
+        int oldState = m_state; // Create a variable to store the old state. 
Using a variable is important as
+                                // after the next instruction, the getState() 
method must return INVALID.
         m_state = INVALID; // Set here to avoid to create instances during the 
stops.
 
         Set col = m_componentInstances.keySet();
@@ -533,7 +535,7 @@ public abstract class IPojoFactory imple
             index++;
         }
 
-        if (m_state == VALID) {
+        if (oldState == VALID) { // Check if the old state was valid.
             for (int i = 0; i < m_listeners.size(); i++) {
                 ((FactoryStateListener) m_listeners.get(i)).stateChanged(this, 
INVALID);
             }


Reply via email to