ivanzlenko commented on code in PR #5574:
URL: https://github.com/apache/ignite-3/pull/5574#discussion_r2031438633


##########
modules/core/src/main/java/org/apache/ignite/internal/failure/FailureContext.java:
##########
@@ -30,15 +30,49 @@ public class FailureContext {
     /** Error. */
     private final Throwable err;
 
+    /** Message describing the failure. */
+    private final String message;
+
     /**
-     * Creates instance of {@link FailureContext}.
+     * Creates instance of {@link FailureContext} of {@link 
FailureType#CRITICAL_ERROR} type.
+     *
+     * @param err Exception.
+     */
+    public FailureContext(Throwable err) {
+        this(FailureType.CRITICAL_ERROR, err);
+    }
+
+    /**
+     * Creates instance of {@link FailureContext} corresponding to an unknown 
failure.
      *
      * @param type Failure type.
      * @param err Exception.
      */
     public FailureContext(FailureType type, Throwable err) {
+        this(type, err, "Unknown error");

Review Comment:
   Unknown error - should be a constant



##########
modules/core/src/main/java/org/apache/ignite/internal/hlc/HybridClockImpl.java:
##########
@@ -133,7 +148,12 @@ private void notifyUpdateListeners(long newTs) {
             try {
                 listener.onUpdate(newTs);
             } catch (Throwable e) {
-                log.error("ClockUpdateListener#onUpdate() failed for {} at 
{}", e, listener, newTs);
+                if (failureProcessor != null) {
+                    String errorMessage = 
String.format("ClockUpdateListener#onUpdate() failed for %s at %s", listener, 
newTs);
+                    failureProcessor.process(new FailureContext(e, 
errorMessage));
+                } else {
+                    log.error("ClockUpdateListener#onUpdate() failed for {} at 
{}", e, listener, newTs);
+                }

Review Comment:
   This part is screaming to use IgniteStringFormatter instead of 
String.format. 



-- 
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

Reply via email to