Package de.dlr.proseo.storagemgr.model
Klasse DefaultRetryStrategy<T>
java.lang.Object
de.dlr.proseo.storagemgr.model.DefaultRetryStrategy<T>
A retry strategy for executing atomic operations. The class provides a
mechanism to retry a specified command multiple times until it succeeds or
reaches the configured maximum number of attempts.
- Autor:
- Denys Chaykovskiy
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungDefaultRetryStrategy
(AtomicCommand<T> atomicCommand, int maxAttempts, long waitTime) The constructor initializes the retry strategy with the atomic command to be executed, the maximum number of attempts, and the wait time between each attempt. -
Methodenübersicht
-
Konstruktordetails
-
DefaultRetryStrategy
The constructor initializes the retry strategy with the atomic command to be executed, the maximum number of attempts, and the wait time between each attempt.- Parameter:
atomicCommand
- atomic commandmaxAttempts
- maximal attemptswaitTime
- wait time between retries
-
-
Methodendetails
-
execute
Tries to execute the atomic command and returns its result if successful. If the atomic command throws an IOException, the retry strategy catches and records it. It repeats the execution of the atomic command for a specified number of attempts, waiting for a certain time interval between each attempt. If the maximum number of attempts is reached without a successful execution, the retry strategy throws the recorded exception.- Gibt zurück:
- string with result of strategy execution
- Löst aus:
IOException
- if atom command was not successful maxAttempts times
-