public class PlanExecutionLockServiceImpl extends Object implements PlanExecutionLockService
Constructor and Description |
---|
PlanExecutionLockServiceImpl() |
Modifier and Type | Method and Description |
---|---|
<V> V |
inlineProcessLocks(TriggerableInternalKey internalKey,
AcquisitionPolicy acquisitionPolicy,
Callable<V> callable)
A parallel locking mechanism that allows a backdoor to the standard lock.
|
void |
interruptLockOwner(TriggerableInternalKey internalKey)
Interrupts the owner of the lock represented by
TriggerableInternalKey |
boolean |
isLocked(TriggerableInternalKey internalKey)
Checks if the given
String has been locked |
<V> V |
lock(TriggerableInternalKey internalKey,
AcquisitionPolicy acquisitionPolicy,
Callable<V> callable)
Quick note about the implementation
Since the acquisition policy
AcquisitionPolicy.WAIT can block for an indefinite amount of time
we acquire this lock before trying to take the global execution lock otherwise callers to runWhenNoExecutionRequestsAreBeingMade(Callable)
in the worst case will wait indefinitely. |
<V> V |
runWhenNoExecutionRequestsAreBeingMade(Callable<V> callable)
Executes the given
Callable when there are no requests being made to execute plans |
public <V> V runWhenNoExecutionRequestsAreBeingMade(@NotNull Callable<V> callable) throws Exception
PlanExecutionLockService
Callable
when there are no requests being made to execute plansrunWhenNoExecutionRequestsAreBeingMade
in interface PlanExecutionLockService
V
- callable result typecallable
- to executeException
- if errorpublic boolean isLocked(@NotNull TriggerableInternalKey internalKey)
PlanExecutionLockService
String
has been lockedisLocked
in interface PlanExecutionLockService
internalKey
- to check@Nullable public <V> V lock(@NotNull TriggerableInternalKey internalKey, @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull Callable<V> callable) throws Exception
AcquisitionPolicy.WAIT
can block for an indefinite amount of time
we acquire this lock before trying to take the global execution lock otherwise callers to runWhenNoExecutionRequestsAreBeingMade(Callable)
in the worst case will wait indefinitely.lock
in interface PlanExecutionLockService
V
- callable result typeinternalKey
- to lockacquisitionPolicy
- to acquire the lockcallable
- to executeException
- if error@Nullable public <V> V inlineProcessLocks(@NotNull TriggerableInternalKey internalKey, @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull Callable<V> callable) throws Exception
PlanExecutionLockService
PlanExecutionLockService.isLocked(TriggerableInternalKey)
and PlanExecutionLockService.interruptLockOwner(TriggerableInternalKey)
inlineProcessLocks
in interface PlanExecutionLockService
Exception
public void interruptLockOwner(@NotNull TriggerableInternalKey internalKey)
PlanExecutionLockService
TriggerableInternalKey
interruptLockOwner
in interface PlanExecutionLockService
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.