X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=benchmark%2Fntfbenchmark%2Fsrc%2Fmain%2Fjava%2Fntfbenchmark%2Fimpl%2FNtfbenchNonblockingProducer.java;h=4b44e1d73dbf2f25bffbd3b4de47f83c03e38f10;hb=HEAD;hp=c6e2e8affb2af60bb4f88820498a0546a876439e;hpb=70dfa437ef06c2a4ca19557a1ae5e9fc8a1324a3;p=controller.git diff --git a/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java b/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java index c6e2e8affb..4b44e1d73d 100644 --- a/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java +++ b/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java @@ -8,14 +8,13 @@ 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.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) { @@ -29,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 { @@ -39,6 +38,7 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer { lastOkFuture = result; } } catch (final Exception e) { + LOG.debug("Failed to publish notification", e); ntfError++; } } @@ -50,9 +50,8 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer { try { lastOkFuture.get(); } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } - }