Package uk.sky.cqlmigrate
Class LockConfig.LockConfigBuilder
- java.lang.Object
-
- uk.sky.cqlmigrate.LockConfig.LockConfigBuilder
-
- Direct Known Subclasses:
CassandraLockConfig.CassandraLockConfigBuilder,CassandraNoOpLockConfig.CassandraNoOpLockConfigBuilder
- Enclosing class:
- LockConfig
public static class LockConfig.LockConfigBuilder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringclientIdprotected java.time.DurationpollingIntervalprotected java.time.Durationtimeoutprotected booleanunlockOnFailure
-
Constructor Summary
Constructors Modifier Constructor Description protectedLockConfigBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LockConfigbuild()LockConfig.LockConfigBuilderunlockOnFailure()Release the lock in case of failure.LockConfig.LockConfigBuilderwithPollingInterval(java.time.Duration pollingInterval)Duration to wait after each attempt to acquire the lock.LockConfig.LockConfigBuilderwithTimeout(java.time.Duration timeout)Duration to attempt to acquire lock for.
-
-
-
Method Detail
-
withPollingInterval
public LockConfig.LockConfigBuilder withPollingInterval(java.time.Duration pollingInterval)
Duration to wait after each attempt to acquire the lock.- Parameters:
pollingInterval- defaults to 500 milliseconds.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if value is less than 0
-
withTimeout
public LockConfig.LockConfigBuilder withTimeout(java.time.Duration timeout)
Duration to attempt to acquire lock for.- Parameters:
timeout- defaults to 1 minute- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if value is less than 0
-
unlockOnFailure
public LockConfig.LockConfigBuilder unlockOnFailure()
Release the lock in case of failure. Note: default behavior is to leave the lock behind if any failures occurred during migration. This was done to prevent accidental data corruption and bring manual attention to the problem. Use 'unlockOnFailure' to override the default behavior and force cqlmigrate to release the lock.- Returns:
- this
-
build
public LockConfig build()
-
-