com.transferwise.tasks.handler.ChainedTaskRetryPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tw-tasks-core Show documentation
Show all versions of tw-tasks-core Show documentation
Transferwise Tasks Executor - Fire and forget until Alert.
The newest version!
package com.transferwise.tasks.handler;
import com.transferwise.tasks.domain.ITask;
import com.transferwise.tasks.handler.interfaces.ITaskRetryPolicy;
import java.time.ZonedDateTime;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@Getter
@Setter
@Accessors(chain = true)
public class ChainedTaskRetryPolicy implements ITaskRetryPolicy {
private List retryPolicies;
@Override
public ZonedDateTime getRetryTime(ITask task, Throwable t) {
for (ITaskRetryPolicy policy : retryPolicies) {
ZonedDateTime retryTime = policy.getRetryTime(task, t);
if (retryTime != null) {
return retryTime;
}
}
return null;
}
}