Retry method considering its result

51 Views Asked by At

I have some method, that returns object with field boolean done:

public OperationResponse getOperationResponse(YaRequest request) {
    // ...
}
class OperationResponse {
    boolean done;
}

And if done == false I have to retry this method. At most I can retry it 4 times. Using @Retryable will not help here, since @Retryable is focused on exceptions and cannot be reoriented to result values. Throwing an exception doesn't seem like a good option either. Perhaps someone can suggest a more optimal solution?

0

There are 0 best solutions below