Improve segmented journal actor metrics
[controller.git] / benchmark / ntfbenchmark / src / main / java / ntfbenchmark / impl / NtfbenchWTCListener.java
1 /*
2  * Copyright (c) 2015 Cisco Systems and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package ntfbenchmark.impl;
9
10 import com.google.common.util.concurrent.SettableFuture;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
12
13 public class NtfbenchWTCListener extends NtfbenchTestListener {
14     private final int expectedCount;
15     private final SettableFuture<?> allDone = SettableFuture.create();
16
17     public NtfbenchWTCListener(final int expectedSize, final int expectedCount) {
18         super(expectedSize);
19         this.expectedCount = expectedCount;
20     }
21
22     @Override
23     public void onNotification(final Ntfbench notification) {
24         super.onNotification(notification);
25         if (expectedCount == getReceived()) {
26             allDone.set(null);
27         }
28     }
29
30     @Override
31     public SettableFuture<?> getAllDone() {
32         return allDone;
33     }
34 }