org.drools.persistence.jpa
Class OptimisticLockRetryInterceptor
java.lang.Object
org.drools.core.command.impl.AbstractInterceptor
org.drools.persistence.jpa.OptimisticLockRetryInterceptor
- All Implemented Interfaces:
- org.drools.core.command.CommandService, org.drools.core.command.Interceptor, org.kie.api.runtime.CommandExecutor
public class OptimisticLockRetryInterceptor
- extends org.drools.core.command.impl.AbstractInterceptor
Interceptor that is capable of retrying command execution. It is intended to retry only if right exception
has been thrown. By default it will look for org.hibernate.StaleObjectStateException and only
then attempt to retry.
Since this is Hibernate specific class another can be given as system property to override default. Name of the
system property org.kie.optlock.exclass and its value should be fully qualified class name of the
exception that indicates OptimisticLocking.
By default it will:
- Retry 3 times
- First retry will be attempted after 50 milliseconds
- next retries will be calculated as last sleep time multiplied by a factor (default factor is 4)
In case all retries failed origin exception will be thrown.
| Methods inherited from class org.drools.core.command.impl.AbstractInterceptor |
executeNext, getContext, getNext, setNext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
targetExceptionClass
protected Class<?> targetExceptionClass
OptimisticLockRetryInterceptor
public OptimisticLockRetryInterceptor()
execute
public <T> T execute(org.kie.api.command.Command<T> command)
isCausedByOptimisticLockingFailure
protected boolean isCausedByOptimisticLockingFailure(Throwable throwable)
getRetries
public int getRetries()
setRetries
public void setRetries(int retries)
getDelay
public long getDelay()
setDelay
public void setDelay(long delay)
getDelayFactor
public long getDelayFactor()
setDelayFactor
public void setDelayFactor(long delayFactor)
getTargetExceptionClass
public Class<?> getTargetExceptionClass()
setTargetExceptionClass
public void setTargetExceptionClass(Class<?> targetExceptionClass)
Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.