void (final CompileContext context, final Runnable taskRunnable) { Semaphore counter = COUNTER_KEY.get(context); assert counter != null; counter.down(); myTaskRunner.execute(() -> { try { taskRunnable.run(); } catch (Throwable e) { context.processMessage(new CompilerMessage(getBuilderName(), e)); } finally { counter.up(); } }); }