org.springframework.batch.retry.backoff
Class FixedBackOffPolicy

java.lang.Object
  extended by org.springframework.batch.retry.backoff.StatelessBackOffPolicy
      extended by org.springframework.batch.retry.backoff.FixedBackOffPolicy
All Implemented Interfaces:
BackOffPolicy

public class FixedBackOffPolicy
extends StatelessBackOffPolicy

Implementation of BackOffPolicy that pauses for a fixed period of time before continuing. A pause is implemented using Thread.sleep(long).

setBackOffPeriod(long) is thread-safe and it is safe to call setBackOffPeriod(long) during execution from multiple threads, however this may cause a single retry operation to have pauses of different intervals.

Author:
Rob Harrop, Dave Syer

Constructor Summary
FixedBackOffPolicy()
           
 
Method Summary
protected  void doBackOff()
          Pause for the setBackOffPeriod(long).
 void setBackOffPeriod(long backOffPeriod)
          Set the back off period in milliseconds.
 void setSleeper(Sleeper sleeper)
          Public setter for the Sleeper strategy.
 
Methods inherited from class org.springframework.batch.retry.backoff.StatelessBackOffPolicy
backOff, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedBackOffPolicy

public FixedBackOffPolicy()
Method Detail

setSleeper

public void setSleeper(Sleeper sleeper)
Public setter for the Sleeper strategy.

Parameters:
sleeper - the sleeper to set defaults to ObjectWaitSleeper.

setBackOffPeriod

public void setBackOffPeriod(long backOffPeriod)
Set the back off period in milliseconds. Cannot be < 1. Default value is 1000ms.


doBackOff

protected void doBackOff()
                  throws BackOffInterruptedException
Pause for the setBackOffPeriod(long).

Specified by:
doBackOff in class StatelessBackOffPolicy
Throws:
BackOffInterruptedException - if interrupted during sleep.


Copyright © 2009 SpringSource. All Rights Reserved.