public interface LockRepository<ENTITY_CLASS> extends Repository<LockEntry,ENTITY_CLASS>
Repository interface to manage lock in database, which will be used by LockManager
| Modifier and Type | Method and Description |
|---|---|
void |
deleteAll() |
LockEntry |
findByKey(String lockKey)
Retrieves a lock by key
|
void |
insertUpdate(LockEntry newLock)
a) If there is an existing lock in the database for the same key and owner(existingLock.key==newLock.key &&
existingLoc.owner==newLock.owner), then the lock in database is updated/refreshed with the new values.
|
void |
removeByKeyAndOwner(String lockKey,
String owner)
Removes from database all the locks with the same key(only can be one) and owner
|
void |
updateIfSameOwner(LockEntry newLock)
The only goal of this method is to update(mainly to extend the expiry date) the lock in case is already owned.
|
mapFieldInstances, toEntityinitializevoid insertUpdate(LockEntry newLock) throws LockPersistenceException
newLock - lock to replace the existing one or be inserted.LockPersistenceException - if there is a lock in database with same key, but is expired and belong to
another owner or cannot insert/update the lock for any other reasonvoid updateIfSameOwner(LockEntry newLock) throws LockPersistenceException
newLock - lock to replace the existing one or be inserted.LockPersistenceException - if there is a lock in database with same key, but is expired and belong to
another owner or cannot insert/update the lock for any other reasonLockEntry findByKey(String lockKey)
lockKey - keyvoid removeByKeyAndOwner(String lockKey, String owner)
lockKey - lock keyowner - lock ownervoid deleteAll()
Copyright © 2021. All rights reserved.