geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r807793 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
Date Tue, 25 Aug 2009 20:28:41 GMT
Author: gawor
Date: Tue Aug 25 20:28:40 2009
New Revision: 807793

URL: http://svn.apache.org/viewvc?rev=807793&view=rev
Log:
ensure missing dependencies array is non-zero if GRACE_PERIOD event is fired

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java?rev=807793&r1=807792&r2=807793&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
Tue Aug 25 20:28:40 2009
@@ -280,26 +280,30 @@
                         state = State.WaitForInitialReferences;
                         break;
                     case WaitForInitialReferences:
-                        if (!waitForDependencies || checkAllSatisfiables()) {
-                            state = State.InitialReferencesSatisfied;
-                            break;
-                        } else {
-                            eventDispatcher.blueprintEvent(new BlueprintEvent(BlueprintEvent.GRACE_PERIOD,
getBundleContext().getBundle(), getExtenderBundle(), getMissingDependencies()));
-                            return;
+                        if (waitForDependencies) {
+                            String[] missingDependencies = getMissingDependencies();
+                            if (missingDependencies.length > 0) {
+                                eventDispatcher.blueprintEvent(new BlueprintEvent(BlueprintEvent.GRACE_PERIOD,
getBundleContext().getBundle(), getExtenderBundle(), missingDependencies));
+                                return;
+                            }
                         }
+                        state = State.InitialReferencesSatisfied;
+                        break;
                     case InitialReferencesSatisfied:
                         processTypeConverters();
                         processProcessors();
                         state = State.WaitForInitialReferences2;
                         break;
                     case WaitForInitialReferences2:
-                        if (!waitForDependencies || checkAllSatisfiables()) {
-                            state = State.Create;
-                            break;
-                        } else {
-                            eventDispatcher.blueprintEvent(new BlueprintEvent(BlueprintEvent.GRACE_PERIOD,
getBundleContext().getBundle(), getExtenderBundle(), getMissingDependencies()));
-                            return;
-                        }
+                        if (waitForDependencies) {
+                            String[] missingDependencies = getMissingDependencies();
+                            if (missingDependencies.length > 0) {
+                                eventDispatcher.blueprintEvent(new BlueprintEvent(BlueprintEvent.GRACE_PERIOD,
getBundleContext().getBundle(), getExtenderBundle(), missingDependencies));
+                                return;
+                            }
+                        }                       
+                        state = State.Create;
+                        break;
                     case Create:
                         timeoutFuture.cancel(false);
                         registerServices();
@@ -548,18 +552,6 @@
         }
     }
 
-    private boolean checkAllSatisfiables() {
-        Map<String, List<SatisfiableRecipe>> dependencies = getSatisfiableDependenciesMap();
-        for (List<SatisfiableRecipe> recipes : dependencies.values()) {
-            for (SatisfiableRecipe recipe : recipes) {
-                if (!recipe.isSatisfied()) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
     public void notifySatisfaction(SatisfiableRecipe satisfiable) {
         LOGGER.debug("Notified satisfaction {} in bundle {}: {}",
                 new Object[] { satisfiable.getName(), bundleContext.getBundle().getSymbolicName(),
satisfiable.isSatisfied() });



Mime
View raw message