Package jadex.commons.collection
Class RwAutoLock
- java.lang.Object
-
- jadex.commons.collection.RwAutoLock
-
public class RwAutoLock extends java.lang.Object
Class wrapping a read-write lock mechanism that can be used with try-with-resources.
-
-
Field Summary
Fields Modifier and Type Field Description protected IAutoLock
readunlock
The resource read unlock.protected java.util.concurrent.locks.ReadWriteLock
rwlock
The internal lock.protected IAutoLock
writeunlock
The 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.ReadWriteLock
getLock()
Gets the internal lock.java.util.concurrent.locks.Lock
getReadLock()
Gets the read lock for manual locking.java.util.concurrent.locks.Lock
getWriteLock()
Gets the write lock for manual locking.IAutoLock
readLock()
Locks the read lock for resource-based locking.IAutoLock
writeLock()
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.
-
-