Package com.coditory.sherlock.sql.rxjava
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull com.coditory.sherlock.rxjava.Sherlockbuild()static @NotNull SqlSherlockbuilder()static @NotNull com.coditory.sherlock.rxjava.Sherlockcreate(@NotNull io.r2dbc.spi.ConnectionFactory connectionFactory, @NotNull com.coditory.sherlock.sql.BindingMapper bindingMapper) @NotNull SqlSherlockwithBindingMapper(@NotNull com.coditory.sherlock.sql.BindingMapper bindingMapper) Parameterized statements are vendor specific.@NotNull SqlSherlock@NotNull SqlSherlockwithConnectionFactory(@NotNull io.r2dbc.spi.ConnectionFactory connectionFactory) @NotNull SqlSherlockwithLocksTable(@NotNull String tableName) Methods inherited from class com.coditory.sherlock.rxjava.SherlockWithConnectorBuilder
withLockDuration, withOwnerId, withOwnerIdPolicy, withStaticUniqueOwnerId
-
Field Details
-
DEFAULT_LOCKS_TABLE_NAME
- See Also:
-
-
Method Details
-
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
- Parameters:
tableName- the name of the table that stores locks- Returns:
- the instance
-
withClock
- 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:
buildin classcom.coditory.sherlock.rxjava.SherlockWithConnectorBuilder<SqlSherlock>- Returns:
- sherlock instance
- Throws:
IllegalArgumentException- when some required values are missing
-