Class DefaultLockRepository

java.lang.Object
org.springframework.integration.jdbc.lock.DefaultLockRepository
All Implemented Interfaces:
Closeable, AutoCloseable, InitializingBean, LockRepository

@Repository public class DefaultLockRepository extends Object implements LockRepository, InitializingBean
The default implementation of the LockRepository based on the table from the script presented in the org/springframework/integration/jdbc/schema-*.sql.

This repository can't be shared between different JdbcLockRegistry instances. Otherwise it opens a possibility to break Lock contract, where JdbcLockRegistry uses non-shared ReentrantLocks for local synchronizations.

Since:
4.3
Author:
Dave Syer, Artem Bilan, Glenn Renfro, Gary Russell, Alexandre Strubel, Ruslan Stelmachenko
  • Field Details

    • DEFAULT_TABLE_PREFIX

      public static final String DEFAULT_TABLE_PREFIX
      Default value for the table prefix property.
      See Also:
    • DEFAULT_TTL

      public static final int DEFAULT_TTL
      Default value for the time-to-live property.
      See Also:
  • Constructor Details

    • DefaultLockRepository

      @Autowired public DefaultLockRepository(DataSource dataSource)
      Constructor that initializes the client id that will be associated for all the locks persisted by the store instance to a random UUID.
      Parameters:
      dataSource - the DataSource used to maintain the lock repository.
    • DefaultLockRepository

      public DefaultLockRepository(DataSource dataSource, String id)
      Constructor that allows the user to specify a client id that will be associated for all the locks persisted by the store instance.
      Parameters:
      dataSource - the DataSource used to maintain the lock repository.
      id - the client id to be associated with locks handled by the repository.
      Since:
      4.3.13
  • Method Details