BUG 2221 : Add metering to ShardTransaction actor
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / common / actor / AbstractUntypedActorWithMetering.java
index 5497f93c4371a2c044bdaf05266e40656b4ff50e..04d9a43c2d40c16c3e0058f2be5bf5256df70498 100644 (file)
@@ -12,13 +12,26 @@ package org.opendaylight.controller.cluster.common.actor;
  */
 public abstract class AbstractUntypedActorWithMetering extends AbstractUntypedActor {
 
+    //this is used in the metric name. Some transient actors do not have defined names
+    private String actorNameOverride;
+
     public AbstractUntypedActorWithMetering() {
         if (isMetricsCaptureEnabled())
             getContext().become(new MeteringBehavior(this));
     }
 
+    public AbstractUntypedActorWithMetering(String actorNameOverride){
+        this.actorNameOverride = actorNameOverride;
+        if (isMetricsCaptureEnabled())
+            getContext().become(new MeteringBehavior(this));
+    }
+
     private boolean isMetricsCaptureEnabled(){
         CommonConfig config = new CommonConfig(getContext().system().settings().config());
         return config.isMetricCaptureEnabled();
     }
+
+    public String getActorNameOverride() {
+        return actorNameOverride;
+    }
 }