org.axonframework.repository
Interface LockManager

All Known Implementing Classes:
NullLockManager, OptimisticLockManager, PessimisticLockManager

public interface LockManager

Interface to the lock manager. A lock manager will maintain and validate locks on aggregates of a single type

Since:
0.3
Author:
Allard Buijze

Method Summary
 void obtainLock(Object aggregateIdentifier)
          Obtain a lock for an aggregate with the given aggregateIdentifier.
 void releaseLock(Object aggregateIdentifier)
          Release the lock held for an aggregate with the given aggregateIdentifier.
 boolean validateLock(AggregateRoot aggregate)
          Make sure that the current thread holds a valid lock for the given aggregate.
 

Method Detail

validateLock

boolean validateLock(AggregateRoot aggregate)
Make sure that the current thread holds a valid lock for the given aggregate.

Parameters:
aggregate - the aggregate to validate the lock for
Returns:
true if a valid lock is held, false otherwise

obtainLock

void obtainLock(Object aggregateIdentifier)
Obtain a lock for an aggregate with the given aggregateIdentifier. Depending on the strategy, this method may return immediately or block until a lock is held.

Parameters:
aggregateIdentifier - the identifier of the aggregate to obtains a lock for.

releaseLock

void releaseLock(Object aggregateIdentifier)
Release the lock held for an aggregate with the given aggregateIdentifier. The caller of this method must ensure a valid lock was requested using obtainLock(Object). If no lock was successfully obtained, the behavior of this method is undefined.

Parameters:
aggregateIdentifier - the identifier of the aggregate to release the lock for.


Copyright © 2010-2016. All Rights Reserved.