You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2012/12/18 06:58:39 UTC

svn commit: r1423282 - in /karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal: InstanceImpl.java InstanceServiceImpl.java

Author: ffang
Date: Tue Dec 18 05:58:38 2012
New Revision: 1423282

URL: http://svn.apache.org/viewvc?rev=1423282&view=rev
Log:
[KARAF-2074]ensure admin service always load storage file instance.properties before each operation

Modified:
    karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java
    karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java

Modified: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java?rev=1423282&r1=1423281&r2=1423282&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java Tue Dec 18 05:58:38 2012
@@ -423,6 +423,7 @@ public class InstanceImpl implements Ins
     }
 
     public boolean isAttached() {
+        checkProcess();
         return (process != null);
     }
 

Modified: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java?rev=1423282&r1=1423281&r2=1423282&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java Tue Dec 18 05:58:38 2012
@@ -139,6 +139,7 @@ public class InstanceServiceImpl impleme
    
     public synchronized void refreshInstance() throws Exception {
         try {
+            init();
             File storageFile = new File(storageLocation, STORAGE_FILE);
             if (!storageFile.isFile()) {
                 if (storageFile.exists()) {
@@ -179,6 +180,11 @@ public class InstanceServiceImpl impleme
     }
 
     public synchronized Instance createInstance(String name, InstanceSettings settings, boolean printOutput) throws Exception {
+        try {
+            init();
+        } catch (Exception e) {
+            LOGGER.warn("Unable to reload Karaf instance list", e);
+        }
         if (instances.get(name) != null) {
             throw new IllegalArgumentException("Instance '" + name + "' already exists");
         }
@@ -291,6 +297,11 @@ public class InstanceServiceImpl impleme
     }
 
     public synchronized Instance getInstance(String name) {
+        try {
+            init();
+        } catch (Exception e) {
+            LOGGER.warn("Unable to reload Karaf instance list", e);
+        }
         return instances.get(name);
     }
 
@@ -299,6 +310,11 @@ public class InstanceServiceImpl impleme
     }
 
     public synchronized void renameInstance(String oldName, String newName, boolean printOutput) throws Exception {
+        try {
+            init();
+        } catch (Exception e) {
+            LOGGER.warn("Unable to reload Karaf instance list", e);
+        }
         if (instances.get(newName) != null) {
             throw new IllegalArgumentException("Instance " + newName + " already exists");
         }
@@ -348,6 +364,11 @@ public class InstanceServiceImpl impleme
     }
 
     public synchronized Instance cloneInstance(String name, String cloneName, InstanceSettings settings, boolean printOutput) throws Exception {
+        try {
+            init();
+        } catch (Exception e) {
+            LOGGER.warn("Unable to reload Karaf instance list", e);
+        }
         if (instances.get(cloneName) != null) {
             throw new IllegalArgumentException("Instance " + cloneName + " already exists");
         }