java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.social.JdbcSignInMethodsLock
All Implemented Interfaces:
SignInMethodsLock

@Repository public class JdbcSignInMethodsLock extends Object implements SignInMethodsLock
SignInMethodsLock over a PostgreSQL transaction-level advisory lock on the account: it opens no transaction and holds the lock until the caller's ends, so the removals of the sign-in methods of one account (unlinking an identity, unbinding a certificate) run one after the other and each counts what the previous one left.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.springframework.jdbc.core.simple.JdbcClient
    JDBC client used to run the statement.
    private static final String
    Statement taking the advisory lock of an account, released when the caller's transaction ends.
    (package private) static final int
    First key of the advisory locks of the accounts, which keeps them apart from every other advisory lock.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    lock(UUID userId)
    Takes the lock of an account until the caller's transaction ends; a second caller for the same account waits.

    Methods inherited from class java.lang.Object

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

    • SIGN_IN_METHODS_LOCK_NAMESPACE

      static final int SIGN_IN_METHODS_LOCK_NAMESPACE
      First key of the advisory locks of the accounts, which keeps them apart from every other advisory lock.
      See Also:
    • LOCK_ACCOUNT

      private static final String LOCK_ACCOUNT
      Statement taking the advisory lock of an account, released when the caller's transaction ends.
      See Also:
    • jdbcClient

      private final org.springframework.jdbc.core.simple.JdbcClient jdbcClient
      JDBC client used to run the statement.
  • Constructor Details

    • JdbcSignInMethodsLock

      public JdbcSignInMethodsLock()
  • Method Details

    • lock

      public void lock(UUID userId)
      Description copied from interface: SignInMethodsLock
      Takes the lock of an account until the caller's transaction ends; a second caller for the same account waits.
      Specified by:
      lock in interface SignInMethodsLock
      Parameters:
      userId - identifier of the account.