Class SqlSherlock

java.lang.Object
com.coditory.sherlock.SherlockWithConnectorBuilder<SqlSherlock>
com.coditory.sherlock.sql.SqlSherlock

public final class SqlSherlock extends com.coditory.sherlock.SherlockWithConnectorBuilder<SqlSherlock>
Builds Sherlock that uses SQL database for locking mechanism.
  • Field Details

  • Method Details

    • builder

      @NotNull public static @NotNull SqlSherlock builder()
      Returns:
      new instance of the builder
    • create

      @NotNull public static @NotNull com.coditory.sherlock.Sherlock create(@NotNull @NotNull DataSource dataSource)
      Parameters:
      dataSource - the connection pool to the database
      Returns:
      sql sherlock with default configuration
    • withDataSource

      @NotNull public @NotNull SqlSherlock withDataSource(@NotNull @NotNull DataSource dataSource)
      Parameters:
      dataSource - the connection pool to the database
      Returns:
      the instance
    • withLocksTable

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

      @NotNull public @NotNull SqlSherlock withClock(@NotNull @NotNull Clock clock)
      Parameters:
      clock - time provider used in locking mechanism. Default: SherlockDefaults.DEFAULT_CLOCK
      Returns:
      the instance
    • build

      @NotNull public @NotNull com.coditory.sherlock.Sherlock build()
      Specified by:
      build in class com.coditory.sherlock.SherlockWithConnectorBuilder<SqlSherlock>
      Returns:
      sherlock instance
      Throws:
      IllegalArgumentException - when some required values are missing