Class SqlSherlock

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

public final class SqlSherlock extends com.coditory.sherlock.rxjava.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.rxjava.Sherlock create(@NotNull @NotNull io.r2dbc.spi.ConnectionFactory connectionFactory, @NotNull @NotNull com.coditory.sherlock.sql.BindingMapper bindingMapper)
      Parameters:
      connectionFactory - the connection factory to the database
      Returns:
      sql sherlock with default configuration
    • withConnectionFactory

      @NotNull public @NotNull SqlSherlock withConnectionFactory(@NotNull @NotNull io.r2dbc.spi.ConnectionFactory connectionFactory)
      Parameters:
      connectionFactory - the connection pool to the database
      Returns:
      the instance
    • withBindingMapper

      @NotNull public @NotNull SqlSherlock withBindingMapper(@NotNull @NotNull com.coditory.sherlock.sql.BindingMapper bindingMapper)
      Parameterized statements are vendor specific. That's why you must specify the binding notation with a bindingParameterMapper.
      Parameters:
      bindingMapper - 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.rxjava.Sherlock build()
      Specified by:
      build in class com.coditory.sherlock.rxjava.SherlockWithConnectorBuilder<SqlSherlock>
      Returns:
      sherlock instance
      Throws:
      IllegalArgumentException - when some required values are missing