Murtadha Hubail has submitted this change and it was merged. Change subject: [NO ISSUE][OTH] Replace Inner Class By Lambda ......................................................................
[NO ISSUE][OTH] Replace Inner Class By Lambda - user model changes: no - storage format changes: no - interface changes: no Details: - Replace anonymous inner class by lambda in ApplicationMessageWork. Change-Id: Ia50f5d51401671c1c10453b20ed84d21c49cfe3a Reviewed-on: https://asterix-gerrit.ics.uci.edu/3224 Sonar-Qube: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> --- M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java 1 file changed, 16 insertions(+), 13 deletions(-) Approvals: Anon. E. Moose #1000171: Till Westmann: Looks good to me, approved Jenkins: Verified; No violations found; Verified diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java index f2aa1f4..771832e 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java @@ -18,12 +18,13 @@ */ package org.apache.hyracks.control.cc.work; +import java.util.concurrent.ExecutorService; + import org.apache.hyracks.api.application.ICCServiceContext; import org.apache.hyracks.api.deployment.DeploymentId; import org.apache.hyracks.api.messages.IMessage; import org.apache.hyracks.control.cc.ClusterControllerService; import org.apache.hyracks.control.common.deployment.DeploymentUtils; -import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -48,19 +49,10 @@ final ICCServiceContext ctx = ccs.getContext(); try { final IMessage data = (IMessage) DeploymentUtils.deserialize(message, deploymentId, ctx); - ccs.getExecutor().execute(new Runnable() { - @Override - public void run() { - try { - ctx.getMessageBroker().receivedMessage(data, nodeId); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }); + notifyMessageBroker(ctx, data, nodeId); } catch (Exception e) { - LOGGER.log(Level.WARN, "Error in stats reporting", e); - throw new RuntimeException(e); + LOGGER.error("unexpected error", e); + throw new IllegalStateException(e); } } @@ -68,4 +60,15 @@ public String toString() { return getName() + ": nodeID: " + nodeId; } + + private static void notifyMessageBroker(ICCServiceContext ctx, IMessage msg, String nodeId) { + final ExecutorService executor = ctx.getControllerService().getExecutor(); + executor.execute(() -> { + try { + ctx.getMessageBroker().receivedMessage(msg, nodeId); + } catch (Exception e) { + throw new IllegalStateException(e); + } + }); + } } -- To view, visit https://asterix-gerrit.ics.uci.edu/3224 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia50f5d51401671c1c10453b20ed84d21c49cfe3a Gerrit-PatchSet: 4 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]>
