Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 86241 invoked from network); 14 Dec 2005 13:45:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Dec 2005 13:45:39 -0000 Received: (qmail 15627 invoked by uid 500); 14 Dec 2005 13:45:39 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 15610 invoked by uid 500); 14 Dec 2005 13:45:39 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 15601 invoked by uid 99); 14 Dec 2005 13:45:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Dec 2005 05:45:38 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 14 Dec 2005 05:45:38 -0800 Received: (qmail 86069 invoked by uid 65534); 14 Dec 2005 13:45:18 -0000 Message-ID: <20051214134518.86068.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r356776 - /incubator/activemq/trunk/activeio/src/java/org/activeio/journal/active/ControlFile.java Date: Wed, 14 Dec 2005 13:45:17 -0000 To: activemq-commits@geronimo.apache.org From: jstrachan@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jstrachan Date: Wed Dec 14 05:45:12 2005 New Revision: 356776 URL: http://svn.apache.org/viewcvs?rev=356776&view=rev Log: removed possible threading error Modified: incubator/activemq/trunk/activeio/src/java/org/activeio/journal/active/ControlFile.java Modified: incubator/activemq/trunk/activeio/src/java/org/activeio/journal/active/ControlFile.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activeio/src/java/org/activeio/journal/active/ControlFile.java?rev=356776&r1=356775&r2=356776&view=diff ============================================================================== --- incubator/activemq/trunk/activeio/src/java/org/activeio/journal/active/ControlFile.java (original) +++ incubator/activemq/trunk/activeio/src/java/org/activeio/journal/active/ControlFile.java Wed Dec 14 05:45:12 2005 @@ -66,15 +66,15 @@ * @throws IOException */ public void lock() throws IOException { - if( lock==null ) { - Set set = getVmLockSet(); - synchronized(set) { - if( !set.add(canonicalPath) ) { + Set set = getVmLockSet(); + synchronized (set) { + if (lock == null) { + if (!set.add(canonicalPath)) { throw new IOException("Journal is already opened by this application."); } - + lock = channel.tryLock(); - if( lock ==null ) { + if (lock == null) { set.remove(canonicalPath); throw new IOException("Journal is already opened by another application"); } @@ -84,15 +84,16 @@ /** * Un locks the control file. - * @throws IOException + * + * @throws IOException */ public void unlock() throws IOException { - if( lock != null ) { - Set set = getVmLockSet(); - synchronized(set) { - lock.release(); - lock=null; + Set set = getVmLockSet(); + synchronized (set) { + if (lock != null) { set.remove(canonicalPath); + lock.release(); + lock = null; } } }