Mechanical code cleanup (benchmark) 62/46062/5
authorStephen Kitt <skitt@redhat.com>
Thu, 22 Sep 2016 14:57:35 +0000 (16:57 +0200)
committerTom Pantelis <tpanteli@brocade.com>
Fri, 23 Sep 2016 18:29:11 +0000 (18:29 +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: I8405a58fccb12123bc7f2b5902b85c64ca35887e
Signed-off-by: Stephen Kitt <skitt@redhat.com>
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/listener/DsbenchmarkListenerProvider.java
benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java
benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchTestListener.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/GlobalBindingRTCClient.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RoutedBindingRTClient.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RpcbenchmarkProvider.java

index b46089d..2c25951 100644 (file)
@@ -58,7 +58,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
     private static final InstanceIdentifier<TestStatus> TEST_STATUS_IID =
             InstanceIdentifier.builder(TestStatus.class).build();
 
-    private final AtomicReference<ExecStatus> execStatus = new AtomicReference<ExecStatus>( ExecStatus.Idle );
+    private final AtomicReference<ExecStatus> execStatus = new AtomicReference<>(ExecStatus.Idle);
     private final DsbenchmarkListenerProvider listenerProvider = new DsbenchmarkListenerProvider();
     private final DOMDataBroker domDataBroker;  // Async DOM Broker for use with all DOM operations
     private final DataBroker bindingDataBroker; // Async Binding-Aware Broker for use in tx chains; initialized to
index e2deb46..e589818 100644 (file)
@@ -25,7 +25,7 @@ public class DsbenchmarkListenerProvider {
     private static final InstanceIdentifier<TestExec> TEST_EXEC_IID =
             InstanceIdentifier.builder(TestExec.class).build();
     private final List<ListenerRegistration<DsbenchmarkListener>> listeners =
-            new ArrayList<ListenerRegistration<DsbenchmarkListener>>();
+            new ArrayList<>();
     private DataBroker dataBroker;
 
     public void setDataBroker(DataBroker dataBroker) {
@@ -37,9 +37,9 @@ public class DsbenchmarkListenerProvider {
         for (int i = 0; i < numListeners; i++) {
             DsbenchmarkListener listener = new DsbenchmarkListener();
             listeners.add(dataBroker.registerDataTreeChangeListener(
-                    new DataTreeIdentifier<TestExec>(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID), listener));
+                    new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID), listener));
             listeners.add(dataBroker.registerDataTreeChangeListener(
-                    new DataTreeIdentifier<TestExec>(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID), listener));
+                    new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID), listener));
 
         }
         LOG.info("DsbenchmarkListenerProvider created {} listeneres", numListeners);
index f4db369..ce2adc9 100644 (file)
@@ -29,10 +29,10 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
     public void run() {
         int ntfOk = 0;
         int ntfError = 0;
-        ListenableFuture<? extends Object> lastOkFuture = null;
+        ListenableFuture<?> lastOkFuture = null;
         for (int i = 0; i < this.iterations; i++) {
             try {
-                final ListenableFuture<? extends Object> result = this.publishService.offerNotification(this.ntf);
+                final ListenableFuture<?> result = this.publishService.offerNotification(this.ntf);
                 if (NotificationPublishService.REJECTED == result) {
                     ntfError++;
                 } else {
index e2c876d..cad1d35 100644 (file)
@@ -29,7 +29,7 @@ public class NtfbenchTestListener implements NtfbenchPayloadListener {
         if (expectedSize == notification.getPayload().size()) {
             received++;
         }
-    };
+    }
 
     public int getReceived() {
         return received;
index ea426ba..dd2cad1 100644 (file)
@@ -74,10 +74,7 @@ public class GlobalBindingRTCClient implements RTCClient {
                         rpcError++;
                     }
                 }
-            } catch (InterruptedException e) {
-                rpcError++;
-                LOG.error("Execution failed: ", e);
-            } catch (ExecutionException e) {
+            } catch (InterruptedException | ExecutionException e) {
                 rpcError++;
                 LOG.error("Execution failed: ", e);
             }
index c0e362b..201ed2d 100644 (file)
@@ -83,10 +83,7 @@ public class RoutedBindingRTClient implements RTCClient {
                         rpcError++;
                     }
                 }
-            } catch (InterruptedException e) {
-                rpcError++;
-                LOG.error("Execution failed: ", e);
-            } catch (ExecutionException e) {
+            } catch (InterruptedException | ExecutionException e) {
                 rpcError++;
                 LOG.error("Execution failed: ", e);
             }
index a9c7d38..14358ea 100644 (file)
@@ -45,7 +45,7 @@ public class RpcbenchmarkProvider implements BindingAwareProvider, AutoCloseable
     private static final Logger LOG = LoggerFactory.getLogger(RpcbenchmarkProvider.class);
     private static final GlobalBindingRTCServer gServer = new GlobalBindingRTCServer();
     private static final int testTimeout = 5;
-    private final AtomicReference<ExecStatus> execStatus = new AtomicReference<ExecStatus>(ExecStatus.Idle );
+    private final AtomicReference<ExecStatus> execStatus = new AtomicReference<>(ExecStatus.Idle);
     private RpcConsumerRegistry consumerRegistry;
     private RpcProviderRegistry providerRegistry;
 

©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.