Package com.coditory.sherlock
Class MongoSherlockBuilder
java.lang.Object
com.coditory.sherlock.MongoSherlockBuilder
Builds
Sherlock
that uses MongoDB for locking mechanism.-
Method Summary
Modifier and TypeMethodDescriptioncom.coditory.sherlock.Sherlock
build()
static MongoSherlockBuilder
static com.coditory.sherlock.Sherlock
mongoSherlock
(com.mongodb.client.MongoCollection<org.bson.Document> collection) withLockDuration
(Duration arg0) withLocksCollection
(com.mongodb.client.MongoCollection<org.bson.Document> collection) withOwnerId
(String arg0)
-
Method Details
-
mongoSherlock
- Returns:
- new instance of the builder
-
mongoSherlock
public static com.coditory.sherlock.Sherlock mongoSherlock(com.mongodb.client.MongoCollection<org.bson.Document> collection) - Parameters:
collection
- mongo collection to be used for locking- Returns:
- new instance of mongo sherlock with default configuration
-
withLocksCollection
public MongoSherlockBuilder withLocksCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection) - Parameters:
collection
- mongo collection to be used for locking- Returns:
- the instance
-
withClock
- 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:
IllegalArgumentException
- when some required values are missing
-
withLockDuration
-
withOwnerId
-
withUniqueOwnerId
-
withStaticUniqueOwnerId
-