title: Use case for Lock.tryLock()
body: <p>At <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.html#lock()" rel="noreferrer">API docs</a> of <code>Lock</code>interface for method <code>tryLock()</code>, this code sample is pasted, </p>
  
  <blockquote>
    <p>A typical usage idiom for this method would be:</p>
  
  <pre><code>  Lock lock = ...;
    if (lock.tryLock()) {
        try {
            // manipulate protected state
        } finally {
            lock.unlock();
        }
    } else {
        // perform alternative actions
    }
  </code></pre>
  </blockquote>
  
  <p>My question is , does this use case not existed before Java 5 or folks used to implement it via some other techniques? </p>
  
  <p>I am not able to comprehend the need to execute <strong>perform alternative actions</strong> based on lock availability. </p>
  
  <p>Can somebody please explain real use cases for this?</p>
  
  <p>I am sure this technique is not a straight forward replacement of <code>synchronized</code>to write deadlock free code. </p>