From: jprocter Date: Fri, 12 Jan 2007 15:34:27 +0000 (+0000) Subject: fixed subtle bug in closeChannel behaviour on lock release and debug logging. X-Git-Tag: Release_0.2~186 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c8c7209ad474cce3a5c0e998644ab0eaa0ce9912;p=vamsas.git fixed subtle bug in closeChannel behaviour on lock release and debug logging. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@334 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/uk/ac/vamsas/client/simpleclient/FileLock.java b/src/uk/ac/vamsas/client/simpleclient/FileLock.java index 4ab0a65..ef29f47 100644 --- a/src/uk/ac/vamsas/client/simpleclient/FileLock.java +++ b/src/uk/ac/vamsas/client/simpleclient/FileLock.java @@ -116,16 +116,18 @@ public class FileLock extends Lock { public void release(boolean closeChannel) { if (!isLocked()) return; - if (log.isDebugEnabled()) - log.debug("Releasing advisory lock on "+target); - if (closeChannel) { - if (rafile!=null) + if (rafile!=null) { + if (closeChannel) { try { rafile.close(); } catch (Exception e) { log.debug("Unexpected exception whilst closing RandomAccessFile on "+target, e); } - rafile=null; + rafile=null; // do not hold reference to rafile anymore either + } + if (log.isDebugEnabled()) + log.debug("Releasing advisory lock on "+target); + // TODO: LATER: verify this change in closeChannel semantics really is correct - ArchiveClient works correctly } tidy(); }