com.silverpeas.util
Class ExecutionAttempts
java.lang.Object
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExecutionAttempts
public ExecutionAttempts()
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.