Class MongoSherlockBuilder

java.lang.Object
com.coditory.sherlock.MongoSherlockBuilder

public final class MongoSherlockBuilder extends Object
Builds Sherlock that uses MongoDB for locking mechanism.
  • Method Details

    • mongoSherlock

      public static MongoSherlockBuilder 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

      public MongoSherlockBuilder withClock(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:
      IllegalArgumentException - when some required values are missing
    • withLockDuration

      public MongoSherlockBuilder withLockDuration(Duration arg0)
    • withOwnerId

      public MongoSherlockBuilder withOwnerId(String arg0)
    • withUniqueOwnerId

      public MongoSherlockBuilder withUniqueOwnerId()
    • withStaticUniqueOwnerId

      public MongoSherlockBuilder withStaticUniqueOwnerId()