incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r579786 - /incubator/sling/trunk/assembly/src/main/java/org/apache/sling/assembly/internal/Assembly.java
Date Wed, 26 Sep 2007 20:27:50 GMT
Author: fmeschbe
Date: Wed Sep 26 13:27:50 2007
New Revision: 579786

URL: http://svn.apache.org/viewvc?rev=579786&view=rev
Log:
SLING-24 Do not start/stop linked bundles of an assembly on system start/stop

Modified:
    incubator/sling/trunk/assembly/src/main/java/org/apache/sling/assembly/internal/Assembly.java

Modified: incubator/sling/trunk/assembly/src/main/java/org/apache/sling/assembly/internal/Assembly.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/assembly/src/main/java/org/apache/sling/assembly/internal/Assembly.java?rev=579786&r1=579785&r2=579786&view=diff
==============================================================================
--- incubator/sling/trunk/assembly/src/main/java/org/apache/sling/assembly/internal/Assembly.java
(original)
+++ incubator/sling/trunk/assembly/src/main/java/org/apache/sling/assembly/internal/Assembly.java
Wed Sep 26 13:27:50 2007
@@ -485,8 +485,9 @@
     }
 
     private void ensureStarted() {
-        // do nothing if already started
-        if (this.state >= STATE_STARTED) {
+        // do nothing if already started or if the system is starting up
+        if (this.state >= STATE_STARTED
+            || manager.getBundleContext().getBundle(0).getState() != Bundle.ACTIVE) {
             return;
         }
 
@@ -498,9 +499,13 @@
             InstalledBundle ib = (InstalledBundle) ii.next();
             if (ib.getBundleSpec().isLinked()) {
                 Bundle bundle = ib.getBundle();
+
+                // if the bundle is in uninstalled state, we cannot do anything
                 if (bundle.getState() == Bundle.UNINSTALLED) {
                     this.manager.log(LogService.LOG_ERROR, "Cannot start bundle "
                         + bundle.getSymbolicName() + ", already uninstalled");
+
+                // otherwise start the bundle now
                 } else {
                     try {
                         bundle.start();
@@ -520,8 +525,9 @@
         // make sure this is not unsinstalled
         this.checkUninstalled();
 
-        // already stopped (or never started)
-        if (this.state < STATE_STARTED) {
+        // already stopped (or never started) or the system is shutting down
+        if (this.state < STATE_STARTED
+            || manager.getBundleContext().getBundle(0).getState() != Bundle.ACTIVE) {
             return;
         }
 
@@ -531,9 +537,12 @@
             if (ib.getBundleSpec().isLinked()) {
                 Bundle bundle = ib.getBundle();
 
+                // if the bundle is in uninstalled state, we cannot do anything
                 if (bundle.getState() == Bundle.UNINSTALLED) {
                     this.manager.log(LogService.LOG_INFO, "Bundle "
                         + bundle.getSymbolicName() + " already uninstalled");
+
+                // otherwise stop the bundle now
                 } else {
                     try {
                         bundle.stop();



Mime
View raw message