Implementation of the
that uses a pessimistic locking strategy. Calls to obtainLock will block
until a lock could be obtained. If a lock is obtained by a thread, that thread has guaranteed unique access.
- Allard Buijze
Obtain a lock for an aggregate. This method will block until a lock was successfully obtained.
aggregateIdentifier the identifier of the aggregate to obtains a lock for.
boolean lockObtained = false;
lockObtained = lock.lock();
Release the lock held on the aggregate. If no valid lock is held by the current thread, an exception is thrown.
private volatile boolean isClosed = false;