Package com.coditory.sherlock.sql
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull com.coditory.sherlock.Sherlock
build()
static @NotNull SqlSherlock
builder()
static @NotNull com.coditory.sherlock.Sherlock
create
(@NotNull DataSource dataSource) @NotNull SqlSherlock
@NotNull SqlSherlock
withDataSource
(@NotNull DataSource dataSource) @NotNull SqlSherlock
withLocksTable
(@NotNull String tableName) Methods inherited from class com.coditory.sherlock.SherlockWithConnectorBuilder
withLockDuration, withOwnerId, withOwnerIdPolicy
-
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.Sherlock create(@NotNull @NotNull DataSource dataSource) - Parameters:
dataSource
- the connection pool to the database- Returns:
- sql sherlock with default configuration
-
withDataSource
- Parameters:
dataSource
- 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.Sherlock build()- Specified by:
build
in classcom.coditory.sherlock.SherlockWithConnectorBuilder<SqlSherlock>
- Returns:
- sherlock instance
- Throws:
IllegalArgumentException
- when some required values are missing
-