Package com.helger.base.concurrent
Class AutoLock
java.lang.Object
com.helger.base.concurrent.AutoLock
- All Implemented Interfaces:
AutoCloseable
Small wrapper around
Lock interface to be used in a
try-with-resources statement, so that the unlock happened.- Since:
- 9.0.0
- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release the lock that was acquired in the constructor.
-
Constructor Details
-
AutoLock
Constructor that acquires the provided lock immediately.- Parameters:
aLock- The lock to acquire. May not benull.
-
-
Method Details
-
close
public void close()Release the lock that was acquired in the constructor.- Specified by:
closein interfaceAutoCloseable
-