void () { currentRecursionDepth.set(currentRecursionDepth.get() - 1); if (currentRecursionDepth.get() == 0) { long duration = System.nanoTime() - currentCalculationStart.get(); currentCalculationStart.set(null); myTotalTime.addAndGet(duration); myMaxTime.updateAndGet(old -> Math.max(old, duration)); if (isDispatchThread.get()) { myCountOnEdt.incrementAndGet(); myTimeOnEdt.addAndGet(duration); myMaxTimeOnEdt.updateAndGet(old -> Math.max(old, duration)); } } }