Package edu.wisc.library.ocfl.core.lock
Class ObjectLockBuilder
- java.lang.Object
-
- edu.wisc.library.ocfl.core.lock.ObjectLockBuilder
-
public class ObjectLockBuilder extends Object
Constructs newObjectLockinstances
-
-
Constructor Summary
Constructors Constructor Description ObjectLockBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectLockbuild()Constructs a newObjectLock.ObjectLockBuilderdataSource(DataSource dataSource)Sets the DataSource to use for DB based locking.ObjectLockBuildertableName(String tableName)Sets the name of the table to use for object locking.ObjectLockBuilderwaitTime(long waitTime, TimeUnit timeUnit)Used to override the amount of time the client will wait to obtain an object lock.
-
-
-
Method Detail
-
waitTime
public ObjectLockBuilder waitTime(long waitTime, TimeUnit timeUnit)
Used to override the amount of time the client will wait to obtain an object lock. Default: 10 seconds.- Parameters:
waitTime- wait timetimeUnit- unit of time- Returns:
- builder
-
dataSource
public ObjectLockBuilder dataSource(DataSource dataSource)
Sets the DataSource to use for DB based locking. This MUST be set in order to create a DB lock.- Parameters:
dataSource- the DataSource to use- Returns:
- builder
-
tableName
public ObjectLockBuilder tableName(String tableName)
Sets the name of the table to use for object locking. Default: ocfl_object_lock- Parameters:
tableName- the table name to use- Returns:
- builder
-
build
public ObjectLock build()
Constructs a newObjectLock. If a DataSource was set, then a DB lock is created; otherwise, an in-memory lock is used.- Returns:
- object lock
-
-