I'm using callables quite often , and I've stubled upon a question that irritates me:
Lets say that to run function foo() , one needs to do a couple of checks first.
Should you 1. Insert the checks as part of the Callable :
class A implements Callable<Long> {
...
public Long call() {
check1();
check2();
return (run());
}
- OR , insert all this logic into another class (ALogic) and use the Callable a mere shell for the executor?
class A implements Callable {
...
public Long call() {
ALogic aLogic = new ALogic();
return (aLogic.run());
}
What do you think are the pro's and con's? What do you usually prefer?