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=485eb158074c53702ea876416b8b224b75698f06;hpb=4eafc030622cc6dc155c452b6c6547eac7b5b616;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 485eb15807..4b44e1d73d 100644 --- a/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java +++ b/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java @@ -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); } } } - }