...
Code Block | ||
---|---|---|
| ||
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
...