public class Mongo3LockRepository extends Mongo3RepositoryBase<com.github.cloudyrock.mongock.driver.core.lock.LockEntry> implements com.github.cloudyrock.mongock.driver.core.lock.LockRepository<org.bson.Document>
collection| Constructor and Description |
|---|
Mongo3LockRepository(com.mongodb.client.MongoCollection<org.bson.Document> collection,
boolean indexCreation) |
Mongo3LockRepository(com.mongodb.client.MongoCollection<org.bson.Document> collection,
boolean indexCreation,
ReadWriteConfiguration readWriteConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteAll() |
com.github.cloudyrock.mongock.driver.core.lock.LockEntry |
findByKey(String lockKey)
Retrieves a lock by key
|
protected org.bson.conversions.Bson |
getAcquireLockQuery(String lockKey,
String owner,
boolean onlyIfSameOwner) |
void |
insertUpdate(com.github.cloudyrock.mongock.driver.core.lock.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(com.github.cloudyrock.mongock.driver.core.lock.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(com.github.cloudyrock.mongock.driver.core.lock.LockEntry newLock)
If there is a lock in the database with the same key and owner, updates it.Otherwise throws a LockPersistenceException
|
cleanResidualUniqueKeys, createRequiredUniqueIndex, doesNeedToBeRemoved, dropIndex, getIndexDocument, initialize, isIdIndex, isIndexFine, isRequiredIndexCreated, isRightIndex, isUniqueIndex, mapFieldInstancesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Mongo3LockRepository(com.mongodb.client.MongoCollection<org.bson.Document> collection,
boolean indexCreation)
public Mongo3LockRepository(com.mongodb.client.MongoCollection<org.bson.Document> collection,
boolean indexCreation,
ReadWriteConfiguration readWriteConfiguration)
public void insertUpdate(com.github.cloudyrock.mongock.driver.core.lock.LockEntry newLock)
insertUpdate in interface com.github.cloudyrock.mongock.driver.core.lock.LockRepository<org.bson.Document>newLock - lock to replace the existing one or be inserted.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(com.github.cloudyrock.mongock.driver.core.lock.LockEntry newLock)
updateIfSameOwner in interface com.github.cloudyrock.mongock.driver.core.lock.LockRepository<org.bson.Document>newLock - lock to replace the existing one.com.github.cloudyrock.mongock.driver.core.lock.LockPersistenceException - if there is no lock in the database with the same key and owner or cannot update
the lock for any other reasonpublic com.github.cloudyrock.mongock.driver.core.lock.LockEntry findByKey(String lockKey)
findByKey in interface com.github.cloudyrock.mongock.driver.core.lock.LockRepository<org.bson.Document>lockKey - keypublic void removeByKeyAndOwner(String lockKey, String owner)
removeByKeyAndOwner in interface com.github.cloudyrock.mongock.driver.core.lock.LockRepository<org.bson.Document>lockKey - lock keyowner - lock ownerpublic void deleteAll()
deleteAll in interface com.github.cloudyrock.mongock.driver.core.lock.LockRepository<org.bson.Document>protected void insertUpdate(com.github.cloudyrock.mongock.driver.core.lock.LockEntry newLock,
boolean onlyIfSameOwner)
Copyright © 2021. All rights reserved.