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) withConnection
(Connection connection) 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
- Parameters:
connection
- the connection to the database- Returns:
- sql sherlock with default configuration
-
withConnection
- Parameters:
connection
- the connection 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
-