Class SqlSherlockBuilder

java.lang.Object
com.coditory.sherlock.SqlSherlockBuilder

public final class SqlSherlockBuilder extends Object
Builds Sherlock that uses SQL database for locking mechanism.
  • Field Details

  • Method Details

    • sqlSherlock

      public static SqlSherlockBuilder sqlSherlock()
      Returns:
      new instance of the builder
    • sqlSherlock

      public static com.coditory.sherlock.Sherlock sqlSherlock(Connection connection)
      Parameters:
      connection - the connection to the database
      Returns:
      sql sherlock with default configuration
    • withConnection

      public SqlSherlockBuilder withConnection(Connection connection)
      Parameters:
      connection - the connection to the database
      Returns:
      the instance
    • withLocksTable

      public SqlSherlockBuilder withLocksTable(String tableName)
      Parameters:
      tableName - the name of the table that stores locks
      Returns:
      the instance
    • withClock

      public SqlSherlockBuilder 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 SqlSherlockBuilder withLockDuration(Duration arg0)
    • withOwnerId

      public SqlSherlockBuilder withOwnerId(String arg0)
    • withUniqueOwnerId

      public SqlSherlockBuilder withUniqueOwnerId()
    • withStaticUniqueOwnerId

      public SqlSherlockBuilder withStaticUniqueOwnerId()