class ContextExecutorService {

    protected List<Future<?>> getFuturesOfContext(UUID contextUuid) {
        List<Future<?>> futures = tasks.get(contextUuid);
        if (futures == null) {
            synchronized (tasks) {
                futures = tasks.get(contextUuid);
                if (futures == null) {
                    futures = new ArrayList<Future<?>>();
                    tasks.put(contextUuid, futures);
                }
            }
        }
        return futures;
    }

}