sk0x50 commented on code in PR #4923:
URL: https://github.com/apache/ignite-3/pull/4923#discussion_r1893847206
##########
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:
The `throttleThreadDump` is called by `process` method which is
`synchronized`. So, it looks OK.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]