Class MongoSherlockBuilder


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

      • 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​(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()