Package com.coditory.sherlock
Class SqlSherlockBuilder
java.lang.Object
com.coditory.sherlock.SqlSherlockBuilder
Builds
Sherlock
that uses SQL database for locking mechanism.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncom.coditory.sherlock.Sherlock
build()
static SqlSherlockBuilder
static com.coditory.sherlock.Sherlock
sqlSherlock
(Connection connection) Deprecated.static com.coditory.sherlock.Sherlock
sqlSherlock
(DataSource connectionPool) withConnection
(Connection connection) Deprecated.UsewithConnectionPool(DataSource)
instead.withConnectionPool
(DataSource connectionPool) withLockDuration
(Duration arg0) withLocksTable
(String tableName) withOwnerId
(String arg0)
-
Field Details
-
DEFAULT_LOCKS_TABLE_NAME
- See Also:
-
-
Method Details
-
sqlSherlock
- Returns:
- new instance of the builder
-
sqlSherlock
@Deprecated(since="0.4.17") public static com.coditory.sherlock.Sherlock sqlSherlock(Connection connection) Deprecated.UsewithConnectionPool(DataSource)
instead.- Parameters:
connection
- the connection to the database- Returns:
- sql sherlock with default configuration
- See Also:
-
sqlSherlock
- Parameters:
connectionPool
- the connection to the database- Returns:
- sql sherlock with default configuration
-
withConnection
Deprecated.UsewithConnectionPool(DataSource)
instead.- Parameters:
connection
- the connection to the database- Returns:
- the instance
- See Also:
-
withConnectionPool
- Parameters:
connectionPool
- 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
public com.coditory.sherlock.Sherlock build()- Returns:
- sherlock instance
- Throws:
IllegalArgumentException
- when some required values are missing
-
withLockDuration
-
withOwnerId
-
withUniqueOwnerId
-
withStaticUniqueOwnerId
-
withConnectionPool(DataSource)
instead.