diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java index a794ec330..fc464cefe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LockFile.java @@ -54,8 +54,6 @@ import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.FileChannel; -import java.nio.channels.FileLock; -import java.nio.channels.OverlappingFileLockException; import java.text.MessageFormat; import org.eclipse.jgit.JGitText; @@ -87,8 +85,6 @@ public class LockFile { private final File lck; - private FileLock fLck; - private boolean haveLck; private FileOutputStream os; @@ -131,23 +127,6 @@ public class LockFile { haveLck = true; try { os = new FileOutputStream(lck); - try { - fLck = os.getChannel().tryLock(); - if (fLck == null) - throw new OverlappingFileLockException(); - } catch (OverlappingFileLockException ofle) { - // We cannot use unlock() here as this file is not - // held by us, but we thought we created it. We must - // not delete it, as it belongs to some other process. - // - haveLck = false; - try { - os.close(); - } catch (IOException ioe) { - // Fail by returning haveLck = false. - } - os = null; - } } catch (IOException ioe) { unlock(); throw ioe; @@ -276,7 +255,6 @@ public class LockFile { } else { os.write(content); } - fLck.release(); os.close(); os = null; } catch (IOException ioe) { @@ -337,7 +315,6 @@ public class LockFile { out.flush(); if (fsync) os.getChannel().force(true); - fLck.release(); out.close(); os = null; } catch (IOException ioe) { @@ -472,14 +449,6 @@ public class LockFile { */ public void unlock() { if (os != null) { - if (fLck != null) { - try { - fLck.release(); - } catch (IOException ioe) { - // Huh? - } - fLck = null; - } try { os.close(); } catch (IOException ioe) {