Package com.coditory.sherlock
Class MongoSherlock
- java.lang.Object
-
- com.coditory.sherlock.MongoSherlock
-
public final class MongoSherlock extends java.lang.Object
BuildsSherlock
that uses MongoDB for locking mechanism.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.coditory.sherlock.Sherlock
build()
static MongoSherlock
builder()
MongoSherlock
withClock(java.time.Clock clock)
T
withLockDuration(java.time.Duration arg0)
MongoSherlock
withLocksCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection)
T
withOwnerId(java.lang.String arg0)
T
withStaticUniqueOwnerId()
T
withUniqueOwnerId()
-
-
-
Method Detail
-
builder
public static MongoSherlock builder()
- Returns:
- new instance of the builder
-
withLocksCollection
public MongoSherlock withLocksCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection)
- Parameters:
collection
- mongo collection to be used for locking- Returns:
- the instance
-
withClock
public MongoSherlock withClock(java.time.Clock clock)
- Parameters:
clock
- time provider used in locking mechanism. Default:SherlockDefaults.DEFAULT_CLOCK
- Returns:
- the instance
-
build
public com.coditory.sherlock.Sherlock build()
- Returns:
- sherlock instance
- Throws:
java.lang.IllegalArgumentException
- when some required values are missing
-
withLockDuration
public T withLockDuration(java.time.Duration arg0)
-
withOwnerId
public T withOwnerId(java.lang.String arg0)
-
withUniqueOwnerId
public T withUniqueOwnerId()
-
withStaticUniqueOwnerId
public T withStaticUniqueOwnerId()
-
-