Remove deprecated getDataStoreType methods 96/32396/3
authorTom Pantelis <tpanteli@brocade.com>
Tue, 12 Jan 2016 07:27:11 +0000 (02:27 -0500)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 14 Jan 2016 01:13:46 +0000 (01:13 +0000)
getDataStoreName methods were recently added to DatastoreContext and ActorContext
to replace the getDataStoreType methods. The latter were marked as
deprecated but we can remove them since they aren't public APIs outside
of the context of sal-distributed-datastore. The remaining callers were
migrated to the getDataStoreName methods.

Change-Id: I7dab731d96b3b8c249a59824de4d78ea72500e05
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MemberNode.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiterTest.java

index 8c01110..9f2103f 100644 (file)
@@ -53,7 +53,7 @@ public class DatastoreContext {
     public static final long DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS = TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES);
     public static final int DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE = 2048000;
 
-    private static final Set<String> globalDatastoreTypes = Sets.newConcurrentHashSet();
+    private static final Set<String> globalDatastoreNames = Sets.newConcurrentHashSet();
 
     private InMemoryDOMDataStoreConfigProperties dataStoreProperties;
     private Duration shardTransactionIdleTimeout = DatastoreContext.DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT;
@@ -75,8 +75,8 @@ public class DatastoreContext {
     private boolean transactionDebugContextEnabled = false;
     private String shardManagerPersistenceId;
 
-    public static Set<String> getGlobalDatastoreTypes() {
-        return globalDatastoreTypes;
+    public static Set<String> getGlobalDatastoreNames() {
+        return globalDatastoreNames;
     }
 
     private DatastoreContext() {
@@ -385,14 +385,6 @@ public class DatastoreContext {
             return this;
         }
 
-        /**
-         * @deprecated Use {@link #logicalStoreType(LogicalDatastoreType)} or {@link #dataStoreName(String)}.
-         */
-        @Deprecated
-        public Builder dataStoreType(String dataStoreType){
-            return dataStoreName(dataStoreType);
-        }
-
         public Builder logicalStoreType(LogicalDatastoreType logicalStoreType){
             datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
 
@@ -478,7 +470,7 @@ public class DatastoreContext {
                     maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
 
             if(datastoreContext.dataStoreName != null) {
-                globalDatastoreTypes.add(datastoreContext.dataStoreName);
+                globalDatastoreNames.add(datastoreContext.dataStoreName);
             }
 
             return datastoreContext;
index 5e8b191..5252618 100644 (file)
@@ -185,7 +185,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener,
 
     @Override
     public void onDatastoreContextUpdated(DatastoreContextFactory contextFactory) {
-        LOG.info("DatastoreContext updated for data store {}", actorContext.getDataStoreType());
+        LOG.info("DatastoreContext updated for data store {}", actorContext.getDataStoreName());
 
         actorContext.setDatastoreContext(contextFactory);
         datastoreConfigMXBean.setContext(contextFactory.getBaseDatastoreContext());
index 068d326..a67d3de 100644 (file)
@@ -302,7 +302,7 @@ public class ClusterAdminRpcService implements ClusterAdminService, AutoCloseabl
                 configDataStore.getActorContext() : operDataStore.getActorContext();
         Set<String> allShardNames = actorContext.getConfiguration().getAllShardNames();
 
-        LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorContext.getDataStoreType());
+        LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorContext.getDataStoreName());
 
         for(String shardName: allShardNames) {
             ListenableFuture<T> future = this.<T>ask(actorContext.getShardManager(), messageSupplier.apply(shardName),
index 1dc49dc..7b54107 100644 (file)
@@ -502,17 +502,6 @@ public class ActorContext {
         return datastoreContext.getDataStoreName();
     }
 
-    /**
-     * Get the type of the data store to which this ActorContext belongs
-     *
-     * @return
-     * @deprecated Use {@link #getDataStoreName()} instead.
-     */
-    @Deprecated
-    public String getDataStoreType() {
-        return datastoreContext.getDataStoreName();
-    }
-
     /**
      * Get the current transaction creation rate limit
      * @return
index b83b51c..58c1bd6 100644 (file)
@@ -23,7 +23,7 @@ public class TransactionRateLimiter {
 
     private final ActorContext actorContext;
     private final long commitTimeoutInSeconds;
-    private final String dataStoreType;
+    private final String dataStoreName;
     private final RateLimiter txRateLimiter;
     private final AtomicLong acquireCount = new AtomicLong();
 
@@ -32,7 +32,7 @@ public class TransactionRateLimiter {
     public TransactionRateLimiter(ActorContext actorContext){
         this.actorContext = actorContext;
         this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds();
-        this.dataStoreType = actorContext.getDataStoreType();
+        this.dataStoreName = actorContext.getDataStoreName();
         this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext().getTransactionCreationInitialRateLimit());
     }
 
@@ -65,16 +65,16 @@ public class TransactionRateLimiter {
     private double getRateLimitFromOtherDataStores(){
         // Since we have no rate data for unused Tx's data store, adjust to the rate from another
         // data store that does have rate data.
-        for(String datastoreType: DatastoreContext.getGlobalDatastoreTypes()) {
-            if(datastoreType.equals(this.dataStoreType)) {
+        for(String name: DatastoreContext.getGlobalDatastoreNames()) {
+            if(name.equals(this.dataStoreName)) {
                 continue;
             }
 
-            double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(datastoreType, ActorContext.COMMIT),
+            double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(name, ActorContext.COMMIT),
                     this.commitTimeoutInSeconds);
             if(newRateLimit > 0.0) {
                 LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",
-                        this.dataStoreType, newRateLimit);
+                        this.dataStoreName, newRateLimit);
 
                 return newRateLimit;
             }
index d5d4ad1..0c1a6a2 100644 (file)
@@ -139,7 +139,7 @@ public class MemberNode {
         final Set<String> peerIds = Sets.newHashSet();
         for(String p: peerMemberNames) {
             peerIds.add(ShardIdentifier.builder().memberName(p).shardName(shardName).
-                type(datastore.getActorContext().getDataStoreType()).build().toString());
+                type(datastore.getActorContext().getDataStoreName()).build().toString());
         }
 
         verifyRaftState(datastore, shardName, new RaftStateVerifier() {
index 4b7619d..9ac5c7a 100644 (file)
@@ -109,8 +109,8 @@ public class ClusterAdminRpcServiceTest {
 
             ImmutableMap<String, DatastoreSnapshot> map = ImmutableMap.of(snapshots.get(0).getType(), snapshots.get(0),
                     snapshots.get(1).getType(), snapshots.get(1));
-            verifyDatastoreSnapshot(node.configDataStore().getActorContext().getDataStoreType(),
-                    map.get(node.configDataStore().getActorContext().getDataStoreType()), "cars", "people");
+            verifyDatastoreSnapshot(node.configDataStore().getActorContext().getDataStoreName(),
+                    map.get(node.configDataStore().getActorContext().getDataStoreName()), "cars", "people");
         } finally {
             new File(fileName).delete();
         }
index 2c89716..e570368 100644 (file)
@@ -181,8 +181,8 @@ public class TransactionRateLimiterTest {
         }
 
 
-        DatastoreContext.getGlobalDatastoreTypes().add("config");
-        DatastoreContext.getGlobalDatastoreTypes().add("operational");
+        DatastoreContext.getGlobalDatastoreNames().add("config");
+        DatastoreContext.getGlobalDatastoreNames().add("operational");
 
         TransactionRateLimiter rateLimiter = new TransactionRateLimiter(actorContext);