Remove DatastoreContext#getDataStoreType()
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / utils / ActorContext.java
index bc492887f97eeee69f9b77c5ef5308057768ed49..42deda8227005b6a1ffc39a4b8b20052adcb551f 100644 (file)
@@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
+import org.opendaylight.controller.cluster.datastore.DatastoreContextFactory;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.exceptions.LocalShardNotFoundException;
 import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException;
@@ -172,8 +173,8 @@ public class ActorContext {
         }
     }
 
-    public void setDatastoreContext(DatastoreContext context) {
-        this.datastoreContext = context;
+    public void setDatastoreContext(DatastoreContextFactory contextFactory) {
+        this.datastoreContext = contextFactory.getBaseDatastoreContext();
         setCachedProperties();
 
         // We write the 'updated' volatile to trigger a write memory barrier so that the writes above
@@ -186,7 +187,7 @@ public class ActorContext {
         updated = true;
 
         if(shardManager != null) {
-            shardManager.tell(context, ActorRef.noSender());
+            shardManager.tell(contextFactory, ActorRef.noSender());
         }
     }
 
@@ -477,7 +478,7 @@ public class ActorContext {
      * @return
      */
     public Timer getOperationTimer(String operationName){
-        return getOperationTimer(datastoreContext.getDataStoreType(), operationName);
+        return getOperationTimer(datastoreContext.getDataStoreName(), operationName);
     }
 
     public Timer getOperationTimer(String dataStoreType, String operationName){
@@ -486,13 +487,23 @@ public class ActorContext {
         return metricRegistry.timer(rate);
     }
 
+    /**
+     * Get the name of the data store to which this ActorContext belongs
+     *
+     * @return
+     */
+    public String getDataStoreName() {
+        return datastoreContext.getDataStoreName();
+    }
+
     /**
      * Get the type of the data store to which this ActorContext belongs
      *
      * @return
+     * @deprecated Use {@link #getDataStoreName()} instead.
      */
     public String getDataStoreType() {
-        return datastoreContext.getDataStoreType();
+        return datastoreContext.getDataStoreName();
     }
 
     /**