If I have a FutureTask<String> f, can I get the Callable<String> c object that was used in his constructor?
FutureTask<String> f,
Callable<String> c
Something like:
Callable<String> c = f.getCallable();
Not with FutureTask itself, but you could extend it for your own needs:
FutureTask
class YourFutureTask extends FutureTask<String> { private Callable<String> callable; public YourFutureTask(Callable<String> callable){ super(callable); this.callable = callable; } public Callable<String> getCallable(){ return callable; } }
Not with
FutureTask
itself, but you could extend it for your own needs: