What is the difference from technical perspective between those two listings? First is one that is provided in java doc of lock. Second is mine.
1.
Lock l = ...;
l.lock();
try {
// access the resource protected by this lock
} finally {
l.unlock();
}
2.
Lock l = ...;
try {
l.lock();
// access the resource protected by this lock
} finally {
l.unlock();
}
See Question&Answers more detail:os