Are Locks
auto-closeable? That is, instead of:
Lock someLock = new ReentrantLock();
someLock.lock();
try
{
// ...
}
finally
{
someLock.unlock();
}
...can I say:
try (Lock someLock = new ReentrantLock())
{
someLock.lock();
// ...
}
...in Java 7?
See Question&Answers more detail:os