Class JdbcLockRegistry

java.lang.Object
org.springframework.integration.jdbc.lock.JdbcLockRegistry
All Implemented Interfaces:
org.springframework.integration.support.locks.ExpirableLockRegistry, org.springframework.integration.support.locks.LockRegistry, org.springframework.integration.support.locks.RenewableLockRegistry

public class JdbcLockRegistry
extends java.lang.Object
implements org.springframework.integration.support.locks.ExpirableLockRegistry, org.springframework.integration.support.locks.RenewableLockRegistry
An ExpirableLockRegistry using a shared database to co-ordinate the locks. Provides the same semantics as the DefaultLockRegistry, but the locks taken will be global, as long as the underlying database supports the "serializable" isolation level in its transactions.
Since:
4.3
  • Constructor Summary

    Constructors 
    Constructor Description
    JdbcLockRegistry​(LockRepository client)  
  • Method Summary

    Modifier and Type Method Description
    void expireUnusedOlderThan​(long age)  
    java.util.concurrent.locks.Lock obtain​(java.lang.Object lockKey)  
    void renewLock​(java.lang.Object lockKey)  
    void setIdleBetweenTries​(java.time.Duration idleBetweenTries)
    Specify a @link Duration} to sleep between lock record insert/update attempts.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • setIdleBetweenTries

      public void setIdleBetweenTries​(java.time.Duration idleBetweenTries)
      Specify a @link Duration} to sleep between lock record insert/update attempts. Defaults to 100 milliseconds.
      Parameters:
      idleBetweenTries - the Duration to sleep between insert/update attempts.
      Since:
      5.1.8
    • obtain

      public java.util.concurrent.locks.Lock obtain​(java.lang.Object lockKey)
      Specified by:
      obtain in interface org.springframework.integration.support.locks.LockRegistry
    • expireUnusedOlderThan

      public void expireUnusedOlderThan​(long age)
      Specified by:
      expireUnusedOlderThan in interface org.springframework.integration.support.locks.ExpirableLockRegistry
    • renewLock

      public void renewLock​(java.lang.Object lockKey)
      Specified by:
      renewLock in interface org.springframework.integration.support.locks.RenewableLockRegistry