Mechanical code cleanup (sal-distributed-datastore) 70/46070/3
authorStephen Kitt <skitt@redhat.com>
Thu, 22 Sep 2016 15:28:27 +0000 (17:28 +0200)
committerTom Pantelis <tpanteli@brocade.com>
Fri, 23 Sep 2016 18:43:42 +0000 (18:43 +0000)
* Remove unnecessary type specifiers (use Java 7 <>)
* Remove unnecessary "extends Object" declarations
* Remove unnecessary semi-colons
* Merge identical catch blocks
* Remove redundant modifiers:
  - enum constructors are private by default
  - interface properties are public static final by default
  - interface methods are public abstract by default
  - interfaces are abstract by default
  - inner interfaces are static by default
  - inner classes in interfaces are public static by default

Change-Id: I3eb023d9f5b34ce83e69c746efd1ff464bfd6789
Signed-off-by: Stephen Kitt <skitt@redhat.com>
19 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextConfigAdminOverlay.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/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionRateLimitingCallback.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/Dispatchers.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.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/MockIdentifiers.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnerChangeListenerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java

index 9610647..aef9f0d 100644 (file)
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
 
 final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMStoreTransactionChain>
         implements DOMTransactionChain {
-    private static enum State {
+    private enum State {
         RUNNING,
         CLOSING,
         CLOSED,
index 249cd45..495681c 100644 (file)
@@ -112,7 +112,7 @@ final class ModuleShardBackendResolver extends BackendInfoResolver<ShardBackendI
             return NULL_FUTURE;
         }
 
-        final CompletableFuture<ShardBackendInfo> ret = new CompletableFuture<ShardBackendInfo>();
+        final CompletableFuture<ShardBackendInfo> ret = new CompletableFuture<>();
 
         FutureConverters.toJava(actorContext.findPrimaryShardAsync(shardName)).thenCompose(info -> {
             LOG.debug("Looking up primary info for {} from {}", shardName, info);
index 448e810..fcd72fa 100644 (file)
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
 public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
     public static final String CONFIG_ID = "org.opendaylight.controller.cluster.datastore";
 
-    public static interface Listener {
+    public interface Listener {
         void onDatastoreContextUpdated(DatastoreContextFactory contextFactory);
     }
 
index a925e93..e4d17ac 100644 (file)
@@ -174,7 +174,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         LOG.debug("Registering tree listener: {} for tree: {} shard: {}", listener, treeId, shardName);
 
         final DataTreeChangeListenerProxy<L> listenerRegistrationProxy =
-                new DataTreeChangeListenerProxy<L>(actorContext, listener);
+                new DataTreeChangeListenerProxy<>(actorContext, listener);
         listenerRegistrationProxy.init(shardName, treeId);
 
         return listenerRegistrationProxy;
@@ -192,7 +192,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         final String shardName = actorContext.getShardStrategyFactory().getStrategy(treeId).findShard(treeId);
         LOG.debug("Registering cohort: {} for tree: {} shard: {}", cohort, treeId, shardName);
 
-        DataTreeCohortRegistrationProxy<C> cohortProxy = new DataTreeCohortRegistrationProxy<C>(actorContext, subtree, cohort);
+        DataTreeCohortRegistrationProxy<C> cohortProxy =
+                new DataTreeCohortRegistrationProxy<>(actorContext, subtree, cohort);
         cohortProxy.init(shardName);
         return cohortProxy;
     }
index 191cb2e..164dc5e 100644 (file)
@@ -51,7 +51,7 @@ import scala.concurrent.Promise;
  * A transaction potentially spanning multiple backend shards.
  */
 public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIdentifier> implements DOMStoreReadWriteTransaction {
-    private static enum TransactionState {
+    private enum TransactionState {
         OPEN,
         READY,
         CLOSED,
index 8ba2cb9..3da5bed 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 public class TransactionRateLimitingCallback implements OperationCallback{
     private static Ticker TICKER = Ticker.systemTicker();
 
-    private static enum State {
+    private enum State {
         STOPPED,
         RUNNING,
         PAUSED
index 8386e66..bbb5985 100644 (file)
@@ -1518,14 +1518,14 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         }, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client));
     }
 
-    private static interface RunnableMessage extends Runnable {
+    private interface RunnableMessage extends Runnable {
     }
 
     /**
      * The FindPrimaryResponseHandler provides specific callback methods which are invoked when a response to the
      * a remote or local find primary message is processed
      */
-    private static interface FindPrimaryResponseHandler {
+    private interface FindPrimaryResponseHandler {
         /**
          * Invoked when a Failure message is received as a response
          *
index 8de8a9d..15f49c3 100644 (file)
@@ -20,14 +20,14 @@ public class Dispatchers {
 
     private final akka.dispatch.Dispatchers dispatchers;
 
-    public static enum DispatcherType {
+    public enum DispatcherType {
         Client(CLIENT_DISPATCHER_PATH),
         Transaction(TXN_DISPATCHER_PATH),
         Shard(SHARD_DISPATCHER_PATH),
         Notification(NOTIFICATION_DISPATCHER_PATH);
 
         private final String path;
-        private DispatcherType(String path){
+        DispatcherType(String path){
             this.path = path;
         }
         private String path(akka.dispatch.Dispatchers dispatchers){
index 1cb436d..97e3383 100644 (file)
@@ -35,7 +35,7 @@ public final class SerializationUtils {
     public static final ThreadLocal<NormalizedNodeDataOutput> REUSABLE_WRITER_TL = new ThreadLocal<>();
     public static final ThreadLocal<NormalizedNodeDataInput> REUSABLE_READER_TL = new ThreadLocal<>();
 
-    public static interface Applier<T> {
+    public interface Applier<T> {
         void apply(T instance, YangInstanceIdentifier path, NormalizedNode<?, ?> node);
     }
 
index 3a88a72..8686cc4 100644 (file)
@@ -74,7 +74,7 @@ public class ConcurrentDOMDataBrokerTest {
     private final DOMStoreThreePhaseCommitCohort mockCohort1 = mock(DOMStoreThreePhaseCommitCohort.class);
     private final DOMStoreThreePhaseCommitCohort mockCohort2 = mock(DOMStoreThreePhaseCommitCohort.class);
     private final ThreadPoolExecutor futureExecutor =
-            new ThreadPoolExecutor(0, 1, 5, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
+            new ThreadPoolExecutor(0, 1, 5, TimeUnit.SECONDS, new SynchronousQueue<>());
     private ConcurrentDOMDataBroker coordinator;
 
     @Before
index 9ae1e0a..ea7afbf 100644 (file)
@@ -112,7 +112,7 @@ public class DatastoreContextIntrospectorTest {
         updated = introspector.update(null);
         assertEquals("updated", false, updated);
 
-        updated = introspector.update(new Hashtable<String, Object>());
+        updated = introspector.update(new Hashtable<>());
         assertEquals("updated", false, updated);
     }
 
index f9ae1bb..d5f2d6c 100644 (file)
@@ -82,7 +82,7 @@ public class TransactionProxyTest extends AbstractTransactionProxyTest {
     static class TestException extends RuntimeException {
     }
 
-    static interface Invoker {
+    interface Invoker {
         CheckedFuture<?, ReadFailedException> invoke(TransactionProxy proxy) throws Exception;
     }
 
@@ -775,7 +775,7 @@ public class TransactionProxyTest extends AbstractTransactionProxyTest {
                 eq(actorSelection(actorRef)), isA(CloseTransaction.class));
     }
 
-    private static interface TransactionProxyOperation {
+    private interface TransactionProxyOperation {
         void run(TransactionProxy transactionProxy);
     }
 
index 17c6d11..1251ba5 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-;
 
 /**
  * Unit tests for EntityOwnerChangeListener.
index 2164450..40bee07 100644 (file)
@@ -316,8 +316,8 @@ public class ShardManagerTest extends AbstractActorTest {
 
         final Map<String, Entry<ActorRef, DatastoreContext>> shardInfoMap = Collections.synchronizedMap(
                 new HashMap<String, Entry<ActorRef, DatastoreContext>>());
-        shardInfoMap.put("default", new AbstractMap.SimpleEntry<ActorRef, DatastoreContext>(defaultShardActor, null));
-        shardInfoMap.put("topology", new AbstractMap.SimpleEntry<ActorRef, DatastoreContext>(topologyShardActor, null));
+        shardInfoMap.put("default", new AbstractMap.SimpleEntry<>(defaultShardActor, null));
+        shardInfoMap.put("topology", new AbstractMap.SimpleEntry<>(topologyShardActor, null));
 
         final PrimaryShardInfoFutureCache primaryShardInfoCache = new PrimaryShardInfoFutureCache();
         final CountDownLatch newShardActorLatch = new CountDownLatch(2);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.