Class AutoCloseableReentrantReadWriteLock


  • public class AutoCloseableReentrantReadWriteLock
    extends Object
    AutoCloseable wrapper for ReentrantReadWriteLock. Provides readLock() and writeLock() to be used in try-with-resources statement.
    • Constructor Detail

      • AutoCloseableReentrantReadWriteLock

        public AutoCloseableReentrantReadWriteLock()
        Creates a lock with new ReentrantReadWriteLock()
      • AutoCloseableReentrantReadWriteLock

        public AutoCloseableReentrantReadWriteLock​(@NotNull
                                                   ReadWriteLock lock)
        Creates a lock with provided ReadWriteLock
        Parameters:
        lock -
    • Method Detail

      • readLock

        @NotNull
        public AL readLock()
        Same as ReadWriteLock.readLock() but provides AutoCloseable
      • writeLock

        @NotNull
        public AL writeLock()
        Same as ReadWriteLock.readLock() but provides AutoCloseable