I have a sub class of RecursiveTask
which contains a Runnable
object and should execute it.The problem is that the code inside the run method never gets reached although I use ForkJoinPool.execute
in order to not block the main thread.
public class test {
public static void main(String[] args) {
Runnable r = new Runnable() {
@Override
public void run() {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
System.out.println("lo");
}
});
}
};
ATLockTask t = new ATLockTask();
t.runnable = r;
new ForkJoinPool().execute(t);
}
}
public class ATLockTask extends RecursiveTask<Object>{
public Runnable runnable;
@Override
protected Object compute() {
try {
runnable.run();
} catch (Exception e) {
logger.catching(e);
}
return null;
}
}