Class AutoLock

java.lang.Object
com.helger.base.concurrent.AutoLock
All Implemented Interfaces:
AutoCloseable

public class AutoLock extends Object implements 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 Details

    • AutoLock

      public AutoLock(@NonNull Lock aLock)
      Constructor that acquires the provided lock immediately.
      Parameters:
      aLock - The lock to acquire. May not be null.
  • Method Details

    • close

      public void close()
      Release the lock that was acquired in the constructor.
      Specified by:
      close in interface AutoCloseable