servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r750514 - /servicemix/smx4/kernel/trunk/main/src/main/java/org/apache/servicemix/kernel/main/Main.java
Date Thu, 05 Mar 2009 17:19:50 GMT
Author: gnodet
Date: Thu Mar  5 17:19:49 2009
New Revision: 750514

URL: http://svn.apache.org/viewvc?rev=750514&view=rev
Log:
Try to avoid an exception when shutting down

Modified:
    servicemix/smx4/kernel/trunk/main/src/main/java/org/apache/servicemix/kernel/main/Main.java

Modified: servicemix/smx4/kernel/trunk/main/src/main/java/org/apache/servicemix/kernel/main/Main.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/main/src/main/java/org/apache/servicemix/kernel/main/Main.java?rev=750514&r1=750513&r2=750514&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/main/src/main/java/org/apache/servicemix/kernel/main/Main.java
(original)
+++ servicemix/smx4/kernel/trunk/main/src/main/java/org/apache/servicemix/kernel/main/Main.java
Thu Mar  5 17:19:49 2009
@@ -142,6 +142,7 @@
     private int defaultStartLevel = 100;
     private int lockStartLevel = 0;
     private int lockDelay = 1000;
+    private boolean exiting = false;
 
     public Main(String[] args) {
         this.args = args;
@@ -216,7 +217,10 @@
             if (await) {
                 shutdown.await();
             }
-            m_felix.stop();
+            exiting = true;
+            if (m_felix.getState() == Bundle.ACTIVE) {
+                m_felix.stop();
+            }
         } finally {
             unlock();
         }
@@ -1113,8 +1117,10 @@
                             }
                             Thread.sleep(lockDelay);
                         }
-                        System.out.println("Lost the lock, stopping this instance ...");
-                        setStartLevel(lockStartLevel);
+                        if (m_felix.getState() == Bundle.ACTIVE && !exiting) {
+                            System.out.println("Lost the lock, stopping this instance ...");
+                            setStartLevel(lockStartLevel);
+                        }
                         break;
                     } else if (!lockLogged) {
                         System.out.println("Waiting for the lock ...");



Mime
View raw message