Package org.axonframework.common.lock
Class PessimisticLockFactory.Builder
java.lang.Object
org.axonframework.common.lock.PessimisticLockFactory.Builder
- Enclosing class:
PessimisticLockFactory
Builder class for the
PessimisticLockFactory.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquireAttempts(int acquireAttempts) Indicates how many attempts should be done to acquire a lock.build()Builds the PessimisticLockFactory instance using the properties defined in this builderlockAttemptTimeout(int lockAttemptTimeout) The duration of a single attempt to acquire the internal lock.queueLengthThreshold(int maximumQueued) Defines the maximum number of queued threads to allow for this lock.
-
Constructor Details
-
Builder
protected Builder()Default constructor
-
-
Method Details
-
acquireAttempts
Indicates how many attempts should be done to acquire a lock. In combination with thelockAttemptTimeout(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
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
The duration of a single attempt to acquire the internal lock. In combination with theacquireAttempts(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
Builds the PessimisticLockFactory instance using the properties defined in this builder- Returns:
- a fully configured PessimisticLockFactory instance
-