geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r550068 - in /geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo: gbean/runtime/GBeanInstance.java kernel/basic/BasicLifecycleMonitor.java
Date Sat, 23 Jun 2007 17:50:21 GMT
Author: djencks
Date: Sat Jun 23 10:50:20 2007
New Revision: 550068

URL: http://svn.apache.org/viewvc?view=rev&rev=550068
Log:
GERONIMO-3257 introduce ordering so reference collections get updated before dependencies
are notified

Modified:
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?view=diff&rev=550068&r1=550067&r2=550068
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Sat Jun 23 10:50:20 2007
@@ -375,11 +375,13 @@
             throw new InvalidConfigurationException("Could not inject configuration data
into the GBean " + abstractName, e);
         }
 
-        for (int i = 0; i < dependencies.length; i++) {
-            dependencies[i].online();
-        }
+        //Add the reference to all applicable reference collections before possibly starting
the gbean having an
+        //explicit reference to the reference.
         for (int i = 0; i < references.length; i++) {
             references[i].online();
+        }
+        for (int i = 0; i < dependencies.length; i++) {
+            dependencies[i].online();
         }
     }
 

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java?view=diff&rev=550068&r1=550067&r2=550068
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
Sat Jun 23 10:50:20 2007
@@ -23,6 +23,9 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.LinkedHashSet;
+import java.util.ArrayList;
+import java.util.Collection;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -83,7 +86,7 @@
 
         // find all listeners interested in events from this source
         SourceInfo sourceInfo = new SourceInfo(interfaceTypes);
-        HashSet listeners = sourceInfo.getListeners();
+        Set listeners = sourceInfo.getListeners();
         for (Iterator listenerIterator = listenerPatterns.entrySet().iterator(); listenerIterator.hasNext();)
{
             Map.Entry entry = (Map.Entry) listenerIterator.next();
             Set patterns = (Set) entry.getValue();
@@ -131,18 +134,18 @@
         listenerPatterns.remove(listener);
     }
 
-    private synchronized Set getTargets(AbstractName source) {
+    private synchronized Collection getTargets(AbstractName source) {
         SourceInfo targets = (SourceInfo) boundListeners.get(source);
         if (targets == null) {
             // no one is interested in this event
             return Collections.EMPTY_SET;
         } else {
-            return new HashSet(targets.getListeners());
+            return new ArrayList<LifecycleListener>(targets.getListeners());
         }
     }
 
     private void fireLoadedEvent(AbstractName refInfoName) {
-        Set targets = getTargets(refInfoName);
+        Collection targets = getTargets(refInfoName);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -154,7 +157,7 @@
     }
 
     private void fireStartingEvent(AbstractName source) {
-        Set targets = getTargets(source);
+        Collection targets = getTargets(source);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -166,7 +169,7 @@
     }
 
     private void fireRunningEvent(AbstractName source) {
-        Set targets = getTargets(source);
+        Collection targets = getTargets(source);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -178,7 +181,7 @@
     }
 
     private void fireStoppingEvent(AbstractName source) {
-        Set targets = getTargets(source);
+        Collection targets = getTargets(source);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -190,7 +193,7 @@
     }
 
     private void fireStoppedEvent(AbstractName source) {
-        Set targets = getTargets(source);
+        Collection targets = getTargets(source);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -202,7 +205,7 @@
     }
 
     private void fireFailedEvent(AbstractName source) {
-        Set targets = getTargets(source);
+        Collection targets = getTargets(source);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -214,7 +217,7 @@
     }
 
     private void fireUnloadedEvent(AbstractName source) {
-        Set targets = getTargets(source);
+        Collection targets = getTargets(source);
         for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
             LifecycleListener listener = (LifecycleListener) iterator.next();
             try {
@@ -271,7 +274,7 @@
 
     private final class SourceInfo {
         private final Set interfaceTypes;
-        private final HashSet listeners = new HashSet();
+        private final HashSet listeners = new LinkedHashSet();
 
         public SourceInfo(Set interfaceTypes) {
             this.interfaceTypes = interfaceTypes;
@@ -281,7 +284,7 @@
             return interfaceTypes;
         }
 
-        public HashSet getListeners() {
+        public Set getListeners() {
             return listeners;
         }
     }



Mime
View raw message