org.ow2.orchestra.pvm.internal.svc
Class RetryInterceptor

java.lang.Object
  extended by org.ow2.orchestra.pvm.internal.svc.Interceptor
      extended by org.ow2.orchestra.pvm.internal.svc.RetryInterceptor
All Implemented Interfaces:
CommandService

public class RetryInterceptor
extends Interceptor

retries the command execution in case hibernate throws optimistic locking (StaleObjectException) exceptions.

Author:
Tom Baeyens

Field Summary
 
Fields inherited from class org.ow2.orchestra.pvm.internal.svc.Interceptor
next
 
Constructor Summary
RetryInterceptor()
           
 
Method Summary
<T> T
execute(Command<T> command)
           
 long getDelay()
           
 int getDelayFactor()
           
 long getMaxDelay()
           
static Random getRandom()
           
 int getRetries()
           
 void setDelay(long delay)
           
 void setDelayFactor(int delayFactor)
           
 void setMaxDelay(long maxDelay)
           
 void setRetries(int retries)
           
protected  boolean shouldRetry(Command<?> command, RuntimeException e)
           
 
Methods inherited from class org.ow2.orchestra.pvm.internal.svc.Interceptor
getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetryInterceptor

public RetryInterceptor()
Method Detail

execute

public <T> T execute(Command<T> command)

shouldRetry

protected boolean shouldRetry(Command<?> command,
                              RuntimeException e)

getRetries

public int getRetries()

setRetries

public void setRetries(int retries)

getDelay

public long getDelay()

setDelay

public void setDelay(long delay)

getDelayFactor

public int getDelayFactor()

setDelayFactor

public void setDelayFactor(int delayFactor)

getMaxDelay

public long getMaxDelay()
Returns:
the maxDelay

setMaxDelay

public void setMaxDelay(long maxDelay)
Parameters:
maxDelay - the maxDelay to set

getRandom

public static Random getRandom()
Returns:
the random


Copyright © 2011 OW2 Consortium. All Rights Reserved.