From: Robert Varga Date: Fri, 7 Oct 2016 16:03:03 +0000 (+0200) Subject: Update to akka 2.4.11 X-Git-Tag: release/carbon~443 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=733a52ecd52c0319827f167724e188361b0eba5b;hp=f336ffef3aaf674ba23133cb5c5201105e5d8637 Update to akka 2.4.11 Akka has changed declarations, hence we need to deal with Throwable instanceof of Exception. Change-Id: If20161ce109a2eb1a839ec3f34b64878eac43932 Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/MeteringBehavior.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/MeteringBehavior.java index c04e2e9340..36c35be30a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/MeteringBehavior.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/MeteringBehavior.java @@ -12,6 +12,7 @@ import akka.japi.Procedure; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.base.Preconditions; +import com.google.common.base.Throwables; import org.opendaylight.controller.cluster.reporting.MetricsReporter; /** @@ -40,7 +41,7 @@ public class MeteringBehavior implements Procedure { * * @param actor whose behaviour needs to be metered */ - public MeteringBehavior(AbstractUntypedActorWithMetering actor){ + public MeteringBehavior(final AbstractUntypedActorWithMetering actor) { Preconditions.checkArgument(actor != null, "actor must not be null"); this.meteredActor = actor; @@ -49,7 +50,7 @@ public class MeteringBehavior implements Procedure { init(actorName); } - public MeteringBehavior(UntypedActor actor){ + public MeteringBehavior(final UntypedActor actor) { Preconditions.checkArgument(actor != null, "actor must not be null"); this.meteredActor = actor; @@ -57,7 +58,7 @@ public class MeteringBehavior implements Procedure { init(actorName); } - private void init(String actorName){ + private void init(final String actorName) { actorQualifiedName = new StringBuilder(meteredActor.getSelf().path().parent().toStringWithoutAddress()). append("/").append(actorName).toString(); @@ -82,7 +83,7 @@ public class MeteringBehavior implements Procedure { * @throws Exception */ @Override - public void apply(Object message) throws Exception { + public void apply(final Object message) throws Exception { final String messageType = message.getClass().getSimpleName(); final String msgProcessingTimeByMsgType = @@ -94,7 +95,12 @@ public class MeteringBehavior implements Procedure { final Timer.Context context = msgProcessingTimer.time(); final Timer.Context contextByMsgType = msgProcessingTimerByMsgType.time(); - meteredActor.onReceive(message); + try { + meteredActor.onReceive(message); + } catch (Throwable t) { + Throwables.propagateIfPossible(t, Exception.class); + throw Throwables.propagate(t); + } //stop timers contextByMsgType.stop();