closing channel always releases lock (on windows anyhow)
[vamsas.git] / src / uk / ac / vamsas / client / simpleclient / NativeLock.java
index 69b7155..f980f45 100644 (file)
@@ -78,10 +78,11 @@ public class NativeLock extends Lock {
         if (closeChannel && rafile.getChannel().isOpen()) {
             rafile.close();
             rafile=null; 
+        } else {
+          // just release the lock without doing anything to the channe;l
+          if (lock!=null && lock.isValid())
+            lock.release();
         }
-        if (lock!=null && lock.isValid())
-          lock.release();
-        
       }
     } catch (IOException e) {
       log.warn("Whilst releasing lock",e);