X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=benchmark%2Fntfbenchmark%2Fsrc%2Fmain%2Fjava%2Fntfbenchmark%2Fimpl%2FNtfbenchBlockingProducer.java;fp=benchmark%2Fntfbenchmark%2Fsrc%2Fmain%2Fjava%2Fntfbenchmark%2Fimpl%2FNtfbenchBlockingProducer.java;h=b086910f1ccc84764dc4c5c9387fd009b4317d88;hp=0000000000000000000000000000000000000000;hb=46939989aefff4b3f7cfec5c95abc8cae9c79c47;hpb=9120c2cf7c530f566d8af94d4f9dc2cb2d3351f7 diff --git a/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchBlockingProducer.java b/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchBlockingProducer.java new file mode 100644 index 0000000000..b086910f1c --- /dev/null +++ b/benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchBlockingProducer.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2015 Cisco Systems and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * 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 org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; + +public class NtfbenchBlockingProducer extends AbstractNtfbenchProducer { + + public NtfbenchBlockingProducer(final NotificationPublishService publishService, final int iterations, + final int payloadSize) { + super(publishService, iterations, payloadSize); + } + + @Override + public void run() { + int ntfOk = 0; + int ntfError = 0; + + for (int i = 0; i < this.iterations; i++) { + try { + this.publishService.putNotification(this.ntf); + ntfOk++; + } catch (final Exception e) { + ntfError++; + } + } + + this.ntfOk = ntfOk; + this.ntfError = ntfError; + } +}