void () { myInvocationCount.incrementAndGet(); Integer recursionOnStart = currentRecursionDepth.get(); myMaxRecursionDepth.updateAndGet(old -> Math.max(old, recursionOnStart)); if (recursionOnStart == 0) { currentCalculationStart.set(System.nanoTime()); myNonRecursiveCount.incrementAndGet(); } currentRecursionDepth.set(recursionOnStart + 1); }