org.apache.camel.processor.aggregate
Class OptimisticLockRetryPolicy
java.lang.Object
org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy
public class OptimisticLockRetryPolicy
- extends Object
Class to control how failed optimistic locks are tried. This policy supports random and exponential back-off delays.
If randomBackOff is enabled and a value is supplied for retryDelay the value will be ignored.
If randomBackOff is enabled and no value is set for maximumRetryDelay, a default value of 1000ms will
be used, the random delay will be between 0 and 1000 milliseconds.
If both randomBackOff and exponentialBackOff are enabled, exponentialBackOff will take precedence.
If exponentialBackOff is enabled and a value is set for maximumRetryDelay, the retry delay will keep
doubling in value until it reaches or exceeds maximumRetryDelay. After it has reached or exceeded maximumRetryDelay
the value of maximumRetryDelay will be used as the retry delay.
If both exponentialBackOff and randomBackOff are disabled, the value of retryDelay will be used
as the retry delay and remain constant through all the retry attempts.
If the value of maximumRetries is set above zero, retry attempts will stop at the value specified.
The default behaviour of this policy is to retry forever and exponentially increase the back-off delay starting with 50ms.
- Version:
OptimisticLockRetryPolicy
public OptimisticLockRetryPolicy()
shouldRetry
public boolean shouldRetry(int retryCounter)
doDelay
public void doDelay(int retryCounter)
throws InterruptedException
- Throws:
InterruptedException
getMaximumRetries
public int getMaximumRetries()
setMaximumRetries
public void setMaximumRetries(int maximumRetries)
maximumRetries
public OptimisticLockRetryPolicy maximumRetries(int maximumRetries)
getRetryDelay
public long getRetryDelay()
setRetryDelay
public void setRetryDelay(long retryDelay)
retryDelay
public OptimisticLockRetryPolicy retryDelay(long retryDelay)
getMaximumRetryDelay
public long getMaximumRetryDelay()
setMaximumRetryDelay
public void setMaximumRetryDelay(long maximumRetryDelay)
maximumRetryDelay
public OptimisticLockRetryPolicy maximumRetryDelay(long maximumRetryDelay)
isExponentialBackOff
public boolean isExponentialBackOff()
setExponentialBackOff
public void setExponentialBackOff(boolean exponentialBackOff)
exponentialBackOff
public OptimisticLockRetryPolicy exponentialBackOff()
isRandomBackOff
public boolean isRandomBackOff()
setRandomBackOff
public void setRandomBackOff(boolean randomBackOff)
randomBackOff
public OptimisticLockRetryPolicy randomBackOff()
toString
public String toString()
- Overrides:
toString in class Object
Apache Camel