class ContextExecutorService {

    public void cancelContext(UUID contextUuid){
        final ArrayList<Future<?>> toCancel = new ArrayList<Future<?>>(getFuturesOfContext(contextUuid));
        if(!toCancel.isEmpty()) {
            if(log.isDebugEnabled())log.debug("About to cancel " + toCancel.size() + " tasks of context " + contextUuid);
            for (Future<?> future : toCancel) {
                future.cancel(true);
            }
            if(log.isDebugEnabled())log.debug("Cancelled " + toCancel.size() + " tasks of context " + contextUuid);
        }
    }

}