jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r613160 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Date Fri, 18 Jan 2008 13:47:29 GMT
Author: stefan
Date: Fri Jan 18 05:47:29 2008
New Revision: 613160

URL: http://svn.apache.org/viewvc?rev=613160&view=rev
Log:
JCR-1318: Repository Home locked not released despite RepositoryException being thrown.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=613160&r1=613159&r2=613160&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Fri Jan 18 05:47:29 2008
@@ -232,6 +232,7 @@
 
         log.info("Starting repository...");
 
+        boolean succeeded = false;
         try {
             this.repConfig = repConfig;
 
@@ -335,12 +336,18 @@
                 wspJanitor.setDaemon(true);
                 wspJanitor.start();
             }
+
+            succeeded = true;
+            log.info("Repository started");
         } catch (RepositoryException e) {
             log.error("failed to start Repository: " + e.getMessage(), e);
             throw e;
+        } finally {
+            if (!succeeded) {
+                // repository startup failed, clean up...
+                shutdown();
+            }
         }
-
-        log.info("Repository started");
     }
 
     public DataStore getDataStore() {
@@ -988,24 +995,30 @@
             }
         }
 
-        try {
-            vMgr.close();
-        } catch (Exception e) {
-            log.error("Error while closing Version Manager.", e);
+        if (vMgr != null) {
+            try {
+                vMgr.close();
+            } catch (Exception e) {
+                log.error("Error while closing Version Manager.", e);
+            }
         }
 
-        // persist repository properties
-        try {
-            storeRepProps(repProps);
-        } catch (RepositoryException e) {
-            log.error("failed to persist repository properties", e);
+        if (repProps != null) {
+            // persist repository properties
+            try {
+                storeRepProps(repProps);
+            } catch (RepositoryException e) {
+                log.error("failed to persist repository properties", e);
+            }
         }
 
-        try {
-            // close repository file system
-            repStore.close();
-        } catch (FileSystemException e) {
-            log.error("error while closing repository file system", e);
+        if (repStore != null) {
+            try {
+                // close repository file system
+                repStore.close();
+            } catch (FileSystemException e) {
+                log.error("error while closing repository file system", e);
+            }
         }
 
         // make sure this instance is not used anymore



Mime
View raw message