jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r430373 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Date Thu, 10 Aug 2006 13:10:02 GMT
Author: mreutegg
Date: Thu Aug 10 06:10:01 2006
New Revision: 430373

URL: http://svn.apache.org/viewvc?rev=430373&view=rev
Log:
JCR-539: Concurrent Repository.login() throws IllegalStateException

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

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=430373&r1=430372&r2=430373&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Thu Aug 10 06:10:01 2006
@@ -1566,6 +1566,22 @@
          * @throws RepositoryException if an error occured during the initialization
          */
         boolean initialize() throws RepositoryException {
+            // check initialize status
+            try {
+                initLock.readLock().acquire();
+            } catch (InterruptedException e) {
+                throw new RepositoryException("Unable to aquire read lock.", e);
+            }
+            try {
+                if (initialized) {
+                    // already initialized, we're done
+                    return false;
+                }
+            } finally {
+                initLock.readLock().release();
+            }
+
+            // workspace info was not initialized, now check again with write lock
             try {
                 initLock.writeLock().acquire();
             } catch (InterruptedException e) {
@@ -1573,7 +1589,7 @@
             }
             try {
                 if (initialized) {
-                    // already initialized, we're done
+                    // already initialized, some other thread was quicker, we're done
                     return false;
                 }
 



Mime
View raw message