Bump versions 9.0.4-SNAPSHOT
[controller.git] / benchmark / ntfbenchmark / src / main / java / ntfbenchmark / impl / NtfbenchNonblockingProducer.java
index 485eb158074c53702ea876416b8b224b75698f06..4b44e1d73dbf2f25bffbd3b4de47f83c03e38f10 100644 (file)
@@ -5,18 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package ntfbenchmark.impl;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.ExecutionException;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
-
-    private final SettableFuture<?> lastDeliveryFuture = SettableFuture.create();
-
+    private static final Logger LOG = LoggerFactory.getLogger(NtfbenchNonblockingProducer.class);
 
     public NtfbenchNonblockingProducer(final NotificationPublishService publishService, final int iterations,
             final int payloadSize) {
@@ -30,9 +28,9 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
         int ntfOk = 0;
         int ntfError = 0;
         ListenableFuture<?> lastOkFuture = null;
-        for (int i = 0; i < this.iterations; i++) {
+        for (int i = 0; i < iterations; i++) {
             try {
-                final ListenableFuture<?> result = this.publishService.offerNotification(this.ntf);
+                final ListenableFuture<?> result = publishService.offerNotification(ntf);
                 if (NotificationPublishService.REJECTED == result) {
                     ntfError++;
                 } else {
@@ -40,6 +38,7 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
                     lastOkFuture = result;
                 }
             } catch (final Exception e) {
+                LOG.debug("Failed to publish notification", e);
                 ntfError++;
             }
         }
@@ -51,9 +50,8 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
             try {
                 lastOkFuture.get();
             } catch (InterruptedException | ExecutionException e) {
-                throw new RuntimeException(e);
+                throw new IllegalStateException(e);
             }
         }
     }
-
 }