com.silverpeas.util
Class ExecutionAttempts

java.lang.Object
  extended by com.silverpeas.util.ExecutionAttempts

public class ExecutionAttempts
extends Object

This class embeds a logic of reattempting the execution of jobs when an exception is thrown during a job execution. It provides a simple retry mechanism.


Nested Class Summary
static interface ExecutionAttempts.Job
          The interface a job within a retry mechanism should implements.
 
Constructor Summary
ExecutionAttempts()
           
 
Method Summary
static void retry(int maxAttempts, ExecutionAttempts.Job aJob)
          Wraps a job with a retry mechanism.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionAttempts

public ExecutionAttempts()
Method Detail

retry

public static void retry(int maxAttempts,
                         ExecutionAttempts.Job aJob)
                  throws Exception
Wraps a job with a retry mechanism.

Parameters:
maxAttempts - the maximum number of execution attempts that are authorized before throwing really the exception.
aJob - the job to run within a retry mechanism.
Throws:
the - exception the job has thrown when the maximum execution attempts has been reached.
Exception


Copyright © 2016 Silverpeas. All Rights Reserved.