Class SpannerStorageAccessor
java.lang.Object
net.javacrumbs.shedlock.support.AbstractStorageAccessor
net.javacrumbs.shedlock.provider.spanner.SpannerStorageAccessor
- All Implemented Interfaces:
net.javacrumbs.shedlock.support.StorageAccessor
public class SpannerStorageAccessor
extends net.javacrumbs.shedlock.support.AbstractStorageAccessor
Accessor for managing lock records within a Google Spanner database.
This class is responsible for inserting, updating, extending, and unlocking
lock records using Spanner's transactions.
-
Field Summary
Fields inherited from class net.javacrumbs.shedlock.support.AbstractStorageAccessor
logger -
Constructor Summary
ConstructorsConstructorDescriptionSpannerStorageAccessor(SpannerLockProvider.Configuration configuration) Constructs aSpannerStorageAccessorusing the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanextend(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Extends the lock until time of an existing lock record if the current host holds the lock.booleaninsertRecord(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Attempts to insert a lock record into the Spanner table.voidunlock(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Unlocks the lock by updating the lock record's lock until time to the unlock time.booleanupdateRecord(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Attempts to update an existing lock record in the Spanner table.Methods inherited from class net.javacrumbs.shedlock.support.AbstractStorageAccessor
getHostname
-
Constructor Details
-
SpannerStorageAccessor
Constructs aSpannerStorageAccessorusing the specified configuration.- Parameters:
configuration- The lock provider configuration.
-
-
Method Details
-
insertRecord
public boolean insertRecord(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Attempts to insert a lock record into the Spanner table.- Parameters:
lockConfiguration- The lock configuration.- Returns:
trueif the lock was successfully inserted, otherwisefalse.
-
updateRecord
public boolean updateRecord(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Attempts to update an existing lock record in the Spanner table.- Parameters:
lockConfiguration- The lock configuration.- Returns:
trueif the lock was successfully updated, otherwisefalse.
-
extend
public boolean extend(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Extends the lock until time of an existing lock record if the current host holds the lock.- Parameters:
lockConfiguration- The lock configuration.- Returns:
trueif the lock was successfully extended, otherwisefalse.
-
unlock
public void unlock(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration) Unlocks the lock by updating the lock record's lock until time to the unlock time.- Parameters:
lockConfiguration- The lock configuration to unlock.
-