Package jadex.commons.collection
Class RwAutoLock
- java.lang.Object
-
- jadex.commons.collection.RwAutoLock
-
public class RwAutoLock extends java.lang.ObjectClass wrapping a read-write lock mechanism that can be used with try-with-resources.
-
-
Field Summary
Fields Modifier and Type Field Description protected IAutoLockreadunlockThe resource read unlock.protected java.util.concurrent.locks.ReadWriteLockrwlockThe internal lock.protected IAutoLockwriteunlockThe resource write unlock.
-
Constructor Summary
Constructors Constructor Description RwAutoLock()Creates the auto-lock.RwAutoLock(java.util.concurrent.locks.ReadWriteLock lock)Creates the auto-lock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.locks.ReadWriteLockgetLock()Gets the internal lock.java.util.concurrent.locks.LockgetReadLock()Gets the read lock for manual locking.java.util.concurrent.locks.LockgetWriteLock()Gets the write lock for manual locking.IAutoLockreadLock()Locks the read lock for resource-based locking.IAutoLockwriteLock()Locks the write lock for resource-based locking.
-
-
-
Method Detail
-
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 java.util.concurrent.locks.Lock getReadLock()
Gets the read lock for manual locking.
-
getWriteLock
public java.util.concurrent.locks.Lock getWriteLock()
Gets the write lock for manual locking.
-
getLock
public java.util.concurrent.locks.ReadWriteLock getLock()
Gets the internal lock.- Returns:
- The lock.
-
-