Package com.coditory.sherlock
Class SqlSherlockBuilder
- java.lang.Object
-
- com.coditory.sherlock.SqlSherlockBuilder
-
public final class SqlSherlockBuilder extends java.lang.ObjectBuildsSherlockthat uses SQL database for locking mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_LOCKS_TABLE_NAME
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.coditory.sherlock.Sherlockbuild()static SqlSherlockBuildersqlSherlock()static com.coditory.sherlock.SherlocksqlSherlock(java.sql.Connection connection)Deprecated.UsewithConnectionPool(DataSource)instead.static com.coditory.sherlock.SherlocksqlSherlock(javax.sql.DataSource connectionPool)SqlSherlockBuilderwithClock(java.time.Clock clock)SqlSherlockBuilderwithConnection(java.sql.Connection connection)Deprecated.UsewithConnectionPool(DataSource)instead.SqlSherlockBuilderwithConnectionPool(javax.sql.DataSource connectionPool)TwithLockDuration(java.time.Duration arg0)SqlSherlockBuilderwithLocksTable(java.lang.String tableName)TwithOwnerId(java.lang.String arg0)TwithStaticUniqueOwnerId()TwithUniqueOwnerId()
-
-
-
Field Detail
-
DEFAULT_LOCKS_TABLE_NAME
public static final java.lang.String DEFAULT_LOCKS_TABLE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
sqlSherlock
public static SqlSherlockBuilder sqlSherlock()
- Returns:
- new instance of the builder
-
sqlSherlock
@Deprecated(since="0.4.17") public static com.coditory.sherlock.Sherlock sqlSherlock(java.sql.Connection connection)
Deprecated.UsewithConnectionPool(DataSource)instead.- Parameters:
connection- the connection to the database- Returns:
- sql sherlock with default configuration
- See Also:
- Recovery after DB outage is failing
-
sqlSherlock
public static com.coditory.sherlock.Sherlock sqlSherlock(javax.sql.DataSource connectionPool)
- Parameters:
connectionPool- the connection to the database- Returns:
- sql sherlock with default configuration
-
withConnection
@Deprecated(since="0.4.17") public SqlSherlockBuilder withConnection(java.sql.Connection connection)
Deprecated.UsewithConnectionPool(DataSource)instead.- Parameters:
connection- the connection to the database- Returns:
- the instance
- See Also:
- Recovery after DB outage is failing
-
withConnectionPool
public SqlSherlockBuilder withConnectionPool(javax.sql.DataSource connectionPool)
- Parameters:
connectionPool- the connection pool to the database- Returns:
- the instance
-
withLocksTable
public SqlSherlockBuilder withLocksTable(java.lang.String tableName)
- Parameters:
tableName- the name of the table that stores locks- Returns:
- the instance
-
withClock
public SqlSherlockBuilder withClock(java.time.Clock clock)
- 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:
java.lang.IllegalArgumentException- when some required values are missing
-
withLockDuration
public T withLockDuration(java.time.Duration arg0)
-
withOwnerId
public T withOwnerId(java.lang.String arg0)
-
withUniqueOwnerId
public T withUniqueOwnerId()
-
withStaticUniqueOwnerId
public T withStaticUniqueOwnerId()
-
-