Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 599 Bytes

execution-context.md

File metadata and controls

23 lines (17 loc) · 599 Bytes
layout title
default
Execution Context

Execution Context

Failsafe can provide an [ExecutionContext] containing execution related information such as the number of execution attempts, start and elapsed times, and the last result or exception:

Failsafe.with(retryPolicy).run(ctx -> {
  log.debug("Connection attempt #{}", ctx.getAttemptCount());
  connect();
});

This is useful for retrying executions that depend on results from a previous attempt:

int result = Failsafe.with(retryPolicy).get(ctx -> ctx.getLastResult(0) + 1);

{% include common-links.html %}