title: Is it possible that a file lock never gets released?
body: <p>Given the following file lock request:</p>
  
  <pre class="lang-java prettyprint-override"><code>FileLock lock = null;
  try {
      lock = randomAccessFile.getChannel().lock(0, Long.MAX_VALUE, mode.shared);
      // work with file
  } finally {
      if (lock != null) {
          lock.release();
      }
  }
  </code></pre>
  
  <p>The targetted OS being MS Windows, is there any chance the <code>finally</code> block won't be ever executed, and thus the lock never released? For example, what if the JVM crashes? How to handle such a no-owner-lock?</p>