Drools :: Persistence :: JPA 6.0.0.CR3

org.drools.persistence.jpa
Class OptimisticLockRetryInterceptor

java.lang.Object
  extended by org.drools.core.command.impl.AbstractInterceptor
      extended by 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:

In case all retries failed origin exception will be thrown.


Field Summary
protected  Class<?> targetExceptionClass
           
 
Constructor Summary
OptimisticLockRetryInterceptor()
           
 
Method Summary
<T> T
execute(org.kie.api.command.Command<T> command)
           
 long getDelay()
           
 long getDelayFactor()
           
 int getRetries()
           
 Class<?> getTargetExceptionClass()
           
protected  boolean isCausedByOptimisticLockingFailure(Throwable throwable)
           
 void setDelay(long delay)
           
 void setDelayFactor(long delayFactor)
           
 void setRetries(int retries)
           
 void setTargetExceptionClass(Class<?> targetExceptionClass)
           
 
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
 

Field Detail

targetExceptionClass

protected Class<?> targetExceptionClass
Constructor Detail

OptimisticLockRetryInterceptor

public OptimisticLockRetryInterceptor()
Method Detail

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)

Drools :: Persistence :: JPA 6.0.0.CR3

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.