Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 9479 invoked from network); 10 Jun 2009 14:07:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jun 2009 14:07:17 -0000 Received: (qmail 92092 invoked by uid 500); 10 Jun 2009 14:07:29 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 92042 invoked by uid 500); 10 Jun 2009 14:07:29 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 92033 invoked by uid 99); 10 Jun 2009 14:07:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2009 14:07:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2009 14:07:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 316A32388896; Wed, 10 Jun 2009 14:07:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r783364 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java kahadb/src/main/java/org/apache/kahadb/util/LockFile.java Date: Wed, 10 Jun 2009 14:06:59 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090610140700.316A32388896@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gtully Date: Wed Jun 10 14:06:59 2009 New Revision: 783364 URL: http://svn.apache.org/viewvc?rev=783364&view=rev Log: fix file lock usage in kahadb store, so shared file system master slave can work Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java?rev=783364&r1=783363&r2=783364&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java Wed Jun 10 14:06:59 2009 @@ -229,7 +229,7 @@ lockFile.lock(); break; } catch (IOException e) { - LOG.info("Database "+lockFileName+" is locked... waiting " + (DATABASE_LOCKED_WAIT_DELAY / 1000) + " seconds for the database to be unlocked."); + LOG.info("Database "+lockFileName+" is locked... waiting " + (DATABASE_LOCKED_WAIT_DELAY / 1000) + " seconds for the database to be unlocked. Reason: " + e); try { Thread.sleep(DATABASE_LOCKED_WAIT_DELAY); } catch (InterruptedException e1) { Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java?rev=783364&r1=783363&r2=783364&view=diff ============================================================================== --- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java (original) +++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java Wed Jun 10 14:06:59 2009 @@ -50,8 +50,7 @@ return; } - lockCounter++; - if( lockCounter!=1 ) { + if( lockCounter>0 ) { return; } @@ -63,9 +62,12 @@ } catch (OverlappingFileLockException e) { throw IOExceptionSupport.create("File '" + file + "' could not be locked.",e); } - if (lock == null) { + if (lock != null) { + lockCounter++; + } else { throw new IOException("File '" + file + "' could not be locked."); } + } }