public class AcquireJobsCmd extends Object implements Command<AcquiredJobs>, OptimisticLockingListener
Modifier and Type | Field and Description |
---|---|
protected AcquiredJobs |
acquiredJobs |
protected int |
numJobsToAcquire |
Constructor and Description |
---|
AcquireJobsCmd(JobExecutor jobExecutor) |
AcquireJobsCmd(JobExecutor jobExecutor,
int numJobsToAcquire) |
Modifier and Type | Method and Description |
---|---|
AcquiredJobs |
execute(CommandContext commandContext) |
OptimisticLockingResult |
failedOperation(DbOperation operation)
Signifies that an operation failed due to optimistic locking.
|
Class<? extends DbEntity> |
getEntityType()
The type of the entity for which this listener should be notified.
|
boolean |
isRetryable()
When CockroachDB is used, this command may be retried multiple times until
it is successful, or the retries are exhausted.
|
protected void |
lockJob(AcquirableJobEntity job) |
protected AcquiredJobs acquiredJobs
protected int numJobsToAcquire
public AcquireJobsCmd(JobExecutor jobExecutor)
public AcquireJobsCmd(JobExecutor jobExecutor, int numJobsToAcquire)
public AcquiredJobs execute(CommandContext commandContext)
execute
in interface Command<AcquiredJobs>
public boolean isRetryable()
isRetryable
in interface Command<AcquiredJobs>
CrdbTransactionRetryInterceptor
can make a transparent retry of this command upon failure
with a CrdbTransactionRetryException
(only used when running on CockroachDB).protected void lockJob(AcquirableJobEntity job)
public Class<? extends DbEntity> getEntityType()
OptimisticLockingListener
getEntityType
in interface OptimisticLockingListener
public OptimisticLockingResult failedOperation(DbOperation operation)
OptimisticLockingListener
failedOperation
in interface OptimisticLockingListener
operation
- the failed operation.OptimisticLockingResult
that instructs the caller how to handle
the result of the failed operation.Copyright © 2022. All rights reserved.