1e63c4b75d4d49a06df88e3d9a6d04d4a64d0a2b
[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
9 package ntfbenchmark.impl;
10
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
12
13 import com.google.common.util.concurrent.SettableFuture;
14
15 public class NtfbenchWTCListener extends NtfbenchTestListener {
16     private final int expectedCount;
17     private final SettableFuture<?> allDone = SettableFuture.create();
18
19     public NtfbenchWTCListener(final int expectedSize, final int expectedCount) {
20         super(expectedSize);
21         this.expectedCount = expectedCount;
22     }
23
24     @Override
25     public void onNtfbench(final Ntfbench notification) {
26         // TODO Auto-generated method stub
27         super.onNtfbench(notification);
28         if (expectedCount == getReceived()) {
29             allDone.set(null);
30         }
31     }
32
33     public SettableFuture<?> getAllDone() {
34         return allDone;
35     }
36 }