Standalone Execution

While the Failsafe class automatically performs executions, including retries, according to the configured policies, the Execution class can be used for situations where you need to control executions and retries yourself.

An Execution can be used to record results and determine whether the execution is considered complete according to the configured policies, else if you should retry:

Execution<Connection> execution = Execution.of(retryPolicy);
while (!execution.isComplete()) {
  try {
  } catch (ConnectException e) {

An Execution is also useful for integrating with APIs that have their own retry mechanism:

Execution<Connection> execution = Execution.of(retryPolicy);

// On exception
if (!execution.isComplete())

See the RxJava example for a more detailed implementation.