rpuch commented on code in PR #4923: URL: https://github.com/apache/ignite-3/pull/4923#discussion_r1893925354
########## modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/FailureManager.java: ########## @@ -225,4 +271,36 @@ public synchronized void setInterceptor(@Nullable FailureHandler interceptor) { FailureHandler handler() { return handler; } + + /** + * Defines whether thread dump should be throttled for given failure type or not. + * + * @param type Failure type. + * @return {@code true} if thread dump generation should be throttled for given failure type. + */ + private boolean throttleThreadDump(FailureType type) { + Map<FailureType, Long> dumpPerFailureTypeTs = threadDumpPerFailureTypeTs; + long dumpThrottlingTimeout = dumpThreadsThrottlingTimeout; + + if (dumpThrottlingTimeout == 0 || dumpPerFailureTypeTs == null) { + return false; + } + + long curr = System.currentTimeMillis(); + + Long last = dumpPerFailureTypeTs.get(type); + + assert last != null : "Unknown failure type " + type; + + boolean throttle = curr - last < dumpThrottlingTimeout; + + if (!throttle) { + dumpPerFailureTypeTs.put(type, curr); Review Comment: Does it make sense to say in its javadoc that it should be called under synchronization? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org