X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fcommon%2Factor%2FAbstractUntypedActorWithMetering.java;h=d20ceb525224a2e91844d4e1be7f5dab140adcd6;hb=HEAD;hp=04d9a43c2d40c16c3e0058f2be5bf5256df70498;hpb=b5167b9bc04f2792b275cfe0eac78c0f5eb9442d;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedActorWithMetering.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedActorWithMetering.java index 04d9a43c2d..d20ceb5252 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedActorWithMetering.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedActorWithMetering.java @@ -7,28 +7,32 @@ */ package org.opendaylight.controller.cluster.common.actor; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + /** * Actor with its behaviour metered. Metering is enabled by configuration. */ public abstract class AbstractUntypedActorWithMetering extends AbstractUntypedActor { - - //this is used in the metric name. Some transient actors do not have defined names + // this is used in the metric name. Some transient actors do not have defined names private String actorNameOverride; + @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "Akka class design") public AbstractUntypedActorWithMetering() { - if (isMetricsCaptureEnabled()) + if (isMetricsCaptureEnabled()) { getContext().become(new MeteringBehavior(this)); + } } - public AbstractUntypedActorWithMetering(String actorNameOverride){ + @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "Akka class design") + public AbstractUntypedActorWithMetering(final String actorNameOverride) { this.actorNameOverride = actorNameOverride; - if (isMetricsCaptureEnabled()) + if (isMetricsCaptureEnabled()) { getContext().become(new MeteringBehavior(this)); + } } - private boolean isMetricsCaptureEnabled(){ - CommonConfig config = new CommonConfig(getContext().system().settings().config()); - return config.isMetricCaptureEnabled(); + private boolean isMetricsCaptureEnabled() { + return new CommonConfig(getContext().system().settings().config()).isMetricCaptureEnabled(); } public String getActorNameOverride() {