public class MongoReactiveLockRepository extends MongoReactiveRepositoryBase<LockEntry> implements LockRepositoryWithEntity<org.bson.Document>
collection| Constructor and Description |
|---|
MongoReactiveLockRepository(com.mongodb.reactivestreams.client.MongoCollection<org.bson.Document> collection) |
MongoReactiveLockRepository(com.mongodb.reactivestreams.client.MongoCollection<org.bson.Document> collection,
ReadWriteConfiguration readWriteConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
LockEntry |
findByKey(String lockKey)
Retrieves a lock by key
|
protected org.bson.conversions.Bson |
getAcquireLockQuery(String lockKey,
String owner,
boolean onlyIfSameOwner) |
void |
insertUpdate(LockEntry newLock)
If there is a lock in the database with the same key, updates it if either is expired or both share the same owner.
|
protected void |
insertUpdate(LockEntry newLock,
boolean onlyIfSameOwner) |
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)
If there is a lock in the database with the same key and owner, updates it.Otherwise, throws a LockPersistenceException
|
cleanResidualUniqueKeys, createRequiredUniqueIndex, deleteAll, doesNeedToBeRemoved, dropIndex, getIndexDocument, initialize, isIdIndex, isIndexFine, isRequiredIndexCreated, isRightIndex, isUniqueIndex, mapFieldInstances, setIndexCreationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeleteAllpublic MongoReactiveLockRepository(com.mongodb.reactivestreams.client.MongoCollection<org.bson.Document> collection)
public MongoReactiveLockRepository(com.mongodb.reactivestreams.client.MongoCollection<org.bson.Document> collection,
ReadWriteConfiguration readWriteConfiguration)
public void insertUpdate(LockEntry newLock)
insertUpdate in interface LockRepositorynewLock - 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 reasonpublic void updateIfSameOwner(LockEntry newLock)
updateIfSameOwner in interface LockRepositorynewLock - lock to replace the existing one.LockPersistenceException - if there is no lock in the database with the same key and owner or cannot update
the lock for any other reasonpublic LockEntry findByKey(String lockKey)
findByKey in interface LockRepositorylockKey - keypublic void removeByKeyAndOwner(String lockKey, String owner)
removeByKeyAndOwner in interface LockRepositorylockKey - lock keyowner - lock ownerprotected void insertUpdate(LockEntry newLock, boolean onlyIfSameOwner)
Copyright © 2023. All rights reserved.