This is an automated email from the ASF dual-hosted git repository. imaxon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit d5edad2eccb0a7fa0ca3e99f19b165deae2417b9 Author: Michael Blow <mb...@apache.org> AuthorDate: Thu Apr 22 08:50:01 2021 -0400 [NO ISSUE][MISC] Misc / minor diagnostic improvement - include target runtimeId & message kind for ActiveManagerMessage.toString() - add ThrowingFunction.asUnchecked() helper Change-Id: I9e1cccb216033f08b69d3000a68dc8593704af9f Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/11143 Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Michael Blow <mb...@apache.org> Reviewed-by: Till Westmann <ti...@apache.org> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> --- .../asterix/active/message/ActiveManagerMessage.java | 2 +- .../org/apache/hyracks/util/ThrowingFunction.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java index 4d726cf..bad3f79 100644 --- a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java +++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java @@ -64,6 +64,6 @@ public class ActiveManagerMessage extends CcIdentifiedMessage implements INcAddr @Override public String toString() { - return getClass().getSimpleName(); + return getClass().getSimpleName() + "{" + "kind=" + kind + ", runtimeId=" + runtimeId + '}'; } } diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ThrowingFunction.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ThrowingFunction.java index d18b41b..f60efbc 100644 --- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ThrowingFunction.java +++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ThrowingFunction.java @@ -18,7 +18,26 @@ */ package org.apache.hyracks.util; +import java.util.function.Function; + +import com.google.common.util.concurrent.UncheckedExecutionException; + @FunctionalInterface public interface ThrowingFunction<I, R> { R process(I input) throws Exception; + + @SuppressWarnings("Duplicates") + static <I, R> Function<I, R> asUnchecked(ThrowingFunction<I, R> consumer) { + return input -> { + try { + return consumer.process(input); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new UncheckedExecutionException(e); + } catch (Exception e) { + throw new UncheckedExecutionException(e); + } + }; + } + }