// Activities client could be decorated directly using CronDecorator and RetryDecorator.
// But executors are used instead to enable updates to invocationHistory.
CronInvocationSchedule cronSchedule = new CronInvocationSchedule(options.getCronExpression(), expiration, tz);
AsyncScheduledExecutor scheduledExecutor = new AsyncScheduledExecutor(cronSchedule, clock);
ExponentialRetryPolicy retryPolicy = createRetryPolicyFromOptions(options);
final AsyncRetryingExecutor retryExecutor = new AsyncRetryingExecutor(retryPolicy, clock);
scheduledExecutor.execute(new AsyncRunnable() {
@Override
public void run() throws Throwable {
retryExecutor.execute(new AsyncRunnable() {
@Override
public void run() throws Throwable {
executeActivityUpdatingInvocationHistory(options);
}