Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 53490 invoked from network); 10 Aug 2006 13:10:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Aug 2006 13:10:24 -0000 Received: (qmail 60733 invoked by uid 500); 10 Aug 2006 13:10:23 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 60692 invoked by uid 500); 10 Aug 2006 13:10:23 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 60683 invoked by uid 99); 10 Aug 2006 13:10:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 06:10:23 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 06:10:23 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id CE2201A981A; Thu, 10 Aug 2006 06:10:02 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r430373 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Date: Thu, 10 Aug 2006 13:10:02 -0000 To: commits@jackrabbit.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060810131002.CE2201A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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; }