I really want to create a subclass of FutureTask that has a default no-arg constructor. In particular, I want my subclass to implement the Callable interface and use it as a callable. This way, MyFutureTask users can simply subclass MyFutureTask instead of implementing their own callers and passing them to a FutureTask instance.
Here's a general idea:
public abstract class MyFutureTask<Result> extends FutureTask<Result> implements Callable<Result> {
public MyFutureTask() {
super( );
}
public abstract Result call() throws Exception;
}
The problem is what can I add in XXX? FutureTask requires Callable, but I can not pass thisbecause java does not allow to refer to thisa call super. I cannot create an instance of a nested class, as this is also forbidden.
Is there a smart (or not smart) way that I can do this?
emmby