Q:

GUI Thread job is not called from callable

I am trying to update the UI from a callable, but fail.
Why is the System.out.println("UI thread."); never called?
I am using SWT.
Callable<Boolean> callable = new Callable<Boolean>() {
    @Override
    public Boolean call() throws Exception {
        System.out.println("Executing Callable.");

        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                System.out.println("UI thread.");
            }
        });

        System.out.println("End.");
        return true;
    }
};

ExecutorService executor = Executors.newFixedThreadPool(10);
executor.submit(callable);

A:

The Problem happened, because i executed the upper code in a JunitTest.
The test returned, before the async Runnable could could be executed.
Waiting at the end of the test - helped!
@Test
public void jobs() {

    Callable<Boolean> callable = new Callable<Boolean>() {
    @Override
    public Boolean call() throws Exception {
        System.out.println("Executing Callable.");

        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                System.out.println("UI thread.");
            }
        });

        System.out.println("End.");
        return true;
    }
};

ExecutorService executor = Executors.newFixedThreadPool(10);
executor.submit(callable);

long stopTimestampt = System.currentTimeMillis() + 1000;
 while (System.currentTimeMillis() < stopTimestampt) {
        Display.getDefault().readAndDispatch();
 }
}

