I'm working with net.jodah.failsafe framework.
From what I found in tutorials, Failsafe can execute Runnable and Supplier.
Is there any API to execute Function? I need it because method, that I want to run with Failsafe, should both: receive argument and return some value.
If not, is there any workaround? The only thing that comes to my mind is to store the argument as private field and in this case method will not need to receive arguments. Smth like this:
instead of that:
class MyClass {
public Integer methodThatWillBeCalledWithFailsafe(String str) {
//do something
return retVal;
}
}
do this:
class MyClass {
private String str;
public Integer methodThatWillBeCalledWithFailsafe() {
//do something using private field str
return retVal;
}
}
Maybe there is more elegant solusion?