Package jadex.common

Class RwAutoLock

java.lang.Object
jadex.common.RwAutoLock

public class RwAutoLock extends Object
Class wrapping a read-write lock mechanism that can be used with try-with-resources.
  • Field Details

    • rwlock

      protected ReadWriteLock rwlock
      The internal lock.
    • readunlock

      protected IAutoLock readunlock
      The resource read unlock.
    • writeunlock

      protected IAutoLock writeunlock
      The resource write unlock.
  • Constructor Details

    • RwAutoLock

      public RwAutoLock()
      Creates the auto-lock.
    • RwAutoLock

      public RwAutoLock(ReadWriteLock lock)
      Creates the auto-lock.
      Parameters:
      lock - Specific RW-lock to use internally.
  • Method Details

    • readLock

      public IAutoLock readLock()
      Locks the read lock for resource-based locking.
    • writeLock

      public IAutoLock writeLock()
      Locks the write lock for resource-based locking.
    • getReadLock

      public Lock getReadLock()
      Gets the read lock for manual locking.
    • getWriteLock

      public Lock getWriteLock()
      Gets the write lock for manual locking.
    • getLock

      public ReadWriteLock getLock()
      Gets the internal lock.
      Returns:
      The lock.