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 8c01110f5caca322bcea29c83642ce9a4d6d0061..9f2103f5e1a8c20b255101b967d0a0a166f137f0 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;
 
     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;
 
     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;
 
     private boolean transactionDebugContextEnabled = false;
     private String shardManagerPersistenceId;
 
-    public static Set<String> getGlobalDatastoreTypes() {
-        return globalDatastoreTypes;
+    public static Set<String> getGlobalDatastoreNames() {
+        return globalDatastoreNames;
     }
 
     private DatastoreContext() {
     }
 
     private DatastoreContext() {
@@ -385,14 +385,6 @@ public class DatastoreContext {
             return this;
         }
 
             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);
 
         public Builder logicalStoreType(LogicalDatastoreType logicalStoreType){
             datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
 
@@ -478,7 +470,7 @@ public class DatastoreContext {
                     maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
 
             if(datastoreContext.dataStoreName != null) {
                     maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
 
             if(datastoreContext.dataStoreName != null) {
-                globalDatastoreTypes.add(datastoreContext.dataStoreName);
+                globalDatastoreNames.add(datastoreContext.dataStoreName);
             }
 
             return datastoreContext;
             }
 
             return datastoreContext;
index 5e8b1913c4cf8550a161a9dd6afd079d5c905e56..5252618fa16b9c06dd910f23a3831f8ffc145072 100644 (file)
@@ -185,7 +185,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener,
 
     @Override
     public void onDatastoreContextUpdated(DatastoreContextFactory contextFactory) {
 
     @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());
 
         actorContext.setDatastoreContext(contextFactory);
         datastoreConfigMXBean.setContext(contextFactory.getBaseDatastoreContext());
index 068d326eff583320caf73fdecf922ab9c3a501d7..a67d3de96402827d81557c5cc4f9a4056255e4c7 100644 (file)
@@ -302,7 +302,7 @@ public class ClusterAdminRpcService implements ClusterAdminService, AutoCloseabl
                 configDataStore.getActorContext() : operDataStore.getActorContext();
         Set<String> allShardNames = actorContext.getConfiguration().getAllShardNames();
 
                 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),
 
         for(String shardName: allShardNames) {
             ListenableFuture<T> future = this.<T>ask(actorContext.getShardManager(), messageSupplier.apply(shardName),
index 1dc49dc88aca5468d075907033110af89368aed9..7b541076def6829c1c13bfde420ca9cbaf0dd991 100644 (file)
@@ -502,17 +502,6 @@ public class ActorContext {
         return datastoreContext.getDataStoreName();
     }
 
         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
     /**
      * Get the current transaction creation rate limit
      * @return
index b83b51c874735d3007a9b184433425bb5766e71c..58c1bd6c257af0482676421906be8d813424a9f5 100644 (file)
@@ -23,7 +23,7 @@ public class TransactionRateLimiter {
 
     private final ActorContext actorContext;
     private final long commitTimeoutInSeconds;
 
     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();
 
     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();
     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());
     }
 
         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.
     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;
             }
 
                 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.commitTimeoutInSeconds);
             if(newRateLimit > 0.0) {
                 LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",
-                        this.dataStoreType, newRateLimit);
+                        this.dataStoreName, newRateLimit);
 
                 return newRateLimit;
             }
 
                 return newRateLimit;
             }
index d5d4ad1afc26b8e7595b30e94ca707ba144bece7..0c1a6a27606f7082450357e16fa875662137556c 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).
         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() {
         }
 
         verifyRaftState(datastore, shardName, new RaftStateVerifier() {
index 4b7619d11ac8df3a6aa18f4d35bb39e1527f4e26..9ac5c7af61d635a71cf040094efb3605760e0cc0 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));
 
             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();
         }
         } finally {
             new File(fileName).delete();
         }
index 2c89716487acf1d03bfe2bca3ff342a99a11d7c4..e57036842d78986ad00764bca85b6bfd0ebd718b 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);
 
 
         TransactionRateLimiter rateLimiter = new TransactionRateLimiter(actorContext);