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

    Constructors
    Constructor
    Description
    Constructs a SpannerStorageAccessor using the specified configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    boolean
    insertRecord(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration)
    Attempts to insert a lock record into the Spanner table.
    void
    unlock(net.javacrumbs.shedlock.core.LockConfiguration lockConfiguration)
    Unlocks the lock by updating the lock record's lock until time to the unlock time.
    boolean
    updateRecord(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpannerStorageAccessor

      public SpannerStorageAccessor(SpannerLockProvider.Configuration configuration)
      Constructs a SpannerStorageAccessor using 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:
      true if the lock was successfully inserted, otherwise false.
    • 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:
      true if the lock was successfully updated, otherwise false.
    • 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:
      true if the lock was successfully extended, otherwise false.
    • 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.