org.apache.cxf.management.web.logging.atom.deliverer
Class RetryingDeliverer

java.lang.Object
  extended by org.apache.cxf.management.web.logging.atom.deliverer.RetryingDeliverer
All Implemented Interfaces:
Deliverer

public final class RetryingDeliverer
extends Object
implements Deliverer

Wrapper on other deliverer retrying delivery in case of failure. Delivery attempts repeat in loop with some pause time between retries until successful delivery or exceeding time limit. Time delay between delivery is configurable strategy. Two predefined strategies are given: each time pause same amount of time (linear) and each next time pause time doubles (exponential).


Nested Class Summary
static interface RetryingDeliverer.PauseCalculator
          Calculates time of subsequent pauses between delivery attempts.
 
Constructor Summary
RetryingDeliverer(Deliverer worker, int timeout, int pause, boolean linear)
          Creates retrying deliverer with predefined retry strategy.
RetryingDeliverer(Deliverer worker, int timeout, RetryingDeliverer.PauseCalculator strategy)
          Creates retrying deliverer with custom retry strategy.
 
Method Summary
 boolean deliver(org.apache.abdera.model.Element element)
          Delivers ATOM element.
 String getEndpointAddress()
          Returns the address of the remote endpoint this deliverer send elements to
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetryingDeliverer

public RetryingDeliverer(Deliverer worker,
                         int timeout,
                         int pause,
                         boolean linear)
Creates retrying deliverer with predefined retry strategy.

Parameters:
worker - real deliverer used to push data out.
timeout - maximum time range (in seconds) that retrial is continued; time spent on delivery call is included. No timeout (infinite loop) if set to zero.
pause - time of pause (in seconds) greater than zero.
linear - if true linear strategy (each time pause same amount of time), exponential otherwise (each next time pause time doubles).

RetryingDeliverer

public RetryingDeliverer(Deliverer worker,
                         int timeout,
                         RetryingDeliverer.PauseCalculator strategy)
Creates retrying deliverer with custom retry strategy.

Parameters:
worker - real deliverer used to push data out.
timeout - maximum time range (in seconds) that retrial is continued; time spent on delivery call is included. No timeout (infinite loop) if set to zero.
strategy - custom retry pausing strategy.
Method Detail

deliver

public boolean deliver(org.apache.abdera.model.Element element)
                throws InterruptedException
Description copied from interface: Deliverer
Delivers ATOM element.

Specified by:
deliver in interface Deliverer
Parameters:
element - element to deliver.
Returns:
true if delivery successful, false otherwise.
Throws:
InterruptedException

getEndpointAddress

public String getEndpointAddress()
Description copied from interface: Deliverer
Returns the address of the remote endpoint this deliverer send elements to

Specified by:
getEndpointAddress in interface Deliverer
Returns:


Apache CXF