Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
public void doSomething() {
  final Lock lock = new ReentrantLock();
  lock.lock();
  try {
    // ...do something with the protected resource
    // This may cause an exception such as FileNotFoundException
  } catch(FileNotFoundException fnf) {
      // handle the exception
  } finally {
      lock.unlock();
  }
}

Risk Assessment

...