Package org.silverpeas.core.util
Class ExecutionAttempts
- java.lang.Object
-
- org.silverpeas.core.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
Nested Classes Modifier and Type Class Description static interface
ExecutionAttempts.Job
The interface a job within a retry mechanism should implements.
-
Constructor Summary
Constructors Constructor Description ExecutionAttempts()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
retry(int maxAttempts, ExecutionAttempts.Job aJob)
Wraps a job with a retry mechanism.
-
-
-
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:
Exception
- the exception the job has thrown when the maximum execution attempts has been reached.
-
-