Class PessimisticLockFactory.Builder

java.lang.Object
org.axonframework.common.lock.PessimisticLockFactory.Builder
Enclosing class:
PessimisticLockFactory

public static class PessimisticLockFactory.Builder extends Object
Builder class for the PessimisticLockFactory.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor
  • Method Details

    • acquireAttempts

      public PessimisticLockFactory.Builder acquireAttempts(int acquireAttempts)
      Indicates how many attempts should be done to acquire a lock. In combination with the lockAttemptTimeout(int), this defines the total timeout of a lock acquisition.

      Defaults to 6000.

      Parameters:
      acquireAttempts - The number of attempts to acquire the lock
      Returns:
      this Builder, for further configuration
    • queueLengthThreshold

      public PessimisticLockFactory.Builder queueLengthThreshold(int maximumQueued)
      Defines the maximum number of queued threads to allow for this lock. If the given number of threads are waiting to acquire a lock, and another thread joins, that thread will immediately fail any attempt to acquire the lock, as if it had timed out.

      Defaults to unbounded.

      Parameters:
      maximumQueued - The maximum number of threads to allow in the queue for this lock
      Returns:
      this Builder, for further configuration
    • lockAttemptTimeout

      public PessimisticLockFactory.Builder lockAttemptTimeout(int lockAttemptTimeout)
      The duration of a single attempt to acquire the internal lock. In combination with the acquireAttempts(int), this defines the total timeout of an acquisition attempt.

      Defaults to 10ms.

      Parameters:
      lockAttemptTimeout - The duration of a single acquisition attempt of the internal lock, in milliseconds
      Returns:
      this Builder, for further configuration
    • build

      public PessimisticLockFactory build()
      Builds the PessimisticLockFactory instance using the properties defined in this builder
      Returns:
      a fully configured PessimisticLockFactory instance