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 9610647fff810449773078c0d3aca51e2e313785..aef9f0d47f3b41c21419097d83df67358238f966 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 7608556e6e8a0ad67d7c6a634c80dc2f70a4fa80..593944f08133d6706d30cdec605d389f8dc3f167 100644 (file)
@@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
  * @author Robert Varga
  */
 abstract class AbstractClientHistory extends LocalAbortable implements Identifiable<LocalHistoryIdentifier> {
-    static enum State {
+    enum State {
         IDLE,
         TX_OPEN,
         CLOSED,
index 249cd4524d5d1f2ea1b925008c035e850abb8a5e..495681cfdf2f25e228136d73f91146c80a71d98a 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 448e810641053748452a2daf481970fe61dba11b..fcd72fa74f039059749896862edfad61bc7485a8 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 a925e93566e9dcff73fd33f1dab458dc2028cfdf..e4d17ac976dff37535f45728272f7eddc055be1f 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 191cb2ef1edcb6e650d50d2769d49ec596059ea0..164dc5ef73370f4811db4b2b590cb3774df2af07 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 8ba2cb9ad936d8636c0b60bf6e40db0493d842d0..3da5bed5a706f57bc7f185dcf36ffd3339072599 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 4a6a37aabe77e43e7b77ba6ba7e7a117caf75328..f1e898ae23042d9da345032d156ea54cfd7b504b 100644 (file)
@@ -599,7 +599,7 @@ class EntityOwnershipShard extends Shard {
     }
 
     @FunctionalInterface
-    private static interface EntityWalker {
+    private interface EntityWalker {
         void onEntity(MapEntryNode entityTypeNode, MapEntryNode entityNode);
     }
 
index 8386e669b83f46cb102771f7c12f1b9458f5e485..bbb598596070bfe2cc0a3a115bc2c1fe14b2d614 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 8de8a9d19304f3572799ee64b728fdf5607b99fa..15f49c3cbc7db5c8a6fdf764b1172383f6d12fc4 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 1cb436d5a349cf341a2279bfe60bd2cbab908473..97e3383490d5bb058d3999c454464c435d16ee0c 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 3a88a729cc8d56b8029159fe0bf2f29de6b2112d..8686cc49815f9773f9f72e0f2c363ac39d95c1e9 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 9ae1e0a9a884b501ccae6487f232f310a66eaf7f..ea7afbf414b8b46b9044664acbc0761444c2e659 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 de751beeb9d91a16dd3f013de2bfdb067d112a27..3aaf027b227577a1128f6387d0477f5396547a1a 100644 (file)
@@ -292,7 +292,7 @@ public class MemberNode {
         }
     }
 
-    public static interface RaftStateVerifier {
+    public interface RaftStateVerifier {
         void verify(OnDemandRaftState raftState);
     }
 }
\ No newline at end of file
index a4062c11933b78cc62a8852d4762e0778861613e..ae07ffdeda3b2d338173176d6d6f36e734d1b98c 100644 (file)
@@ -26,5 +26,5 @@ public final class MockIdentifiers {
 
     public static TransactionIdentifier transactionIdentifier(final Class<?> clazz, final String memberName) {
         return new TransactionIdentifier(historyIdentifier(clazz, memberName), 0);
-    };
+    }
 }
index 9ae74bb47c1b8dd17a2f3f8b8f7a51d9ecbd68b7..0e24c3b86300d2a3a3b6229f68bc5abc8d39b653 100644 (file)
@@ -233,7 +233,7 @@ public class ShardDataTreeTest extends AbstractTest {
     }
 
     @FunctionalInterface
-    private static interface DataTreeOperation {
+    private interface DataTreeOperation {
         void execute(DataTreeModification snapshot);
     }
 
index f9ae1bbd0ff6dcb3524762b45c440eb7780eeb9d..d5f2d6c420370eddb80458b78ec816f985829d2d 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 17c6d11f681992bfc5d415bf101e10fe3a6657bb..1251ba51da08c37df029b20f46a4cd8dec1b4706 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 2164450ed5bc47d6f1b416e5b5e20aff40298a13..40bee07b1daf0ff9b63f05a246c14de202878bf8 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);