private <R> Task<R> doRun(final TaskFunction<LocalObjects.LocalObjectEntry<T>, R> function) { runtime.bind(); final ActorTaskContext actorTaskContext = ActorTaskContext.pushNew(); try { // using await makes the actorTaskContext.pop() run in the wrong thread. // the the internal par is separated return doRunInternal(function, actorTaskContext); } finally { actorTaskContext.pop(); } }