Improve segmented journal actor metrics
[controller.git] / benchmark / rpcbenchmark / src / main / java / rpcbenchmark / impl / AbstractRpcbenchPayloadService.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 rpcbenchmark.impl;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInput;
12 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchOutput;
13 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchOutputBuilder;
14 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput;
15 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutput;
16 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutputBuilder;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
19
20 abstract class AbstractRpcbenchPayloadService {
21     private int numRpcs = 0;
22
23     final ListenableFuture<RpcResult<GlobalRpcBenchOutput>> globalRpcBench(final GlobalRpcBenchInput input) {
24         numRpcs++;
25         return RpcResultBuilder.success(new GlobalRpcBenchOutputBuilder(input).build()).buildFuture();
26     }
27
28     final ListenableFuture<RpcResult<RoutedRpcBenchOutput>> routedRpcBench(final RoutedRpcBenchInput input) {
29         numRpcs++;
30         return RpcResultBuilder.success(new RoutedRpcBenchOutputBuilder(input).build()).buildFuture();
31     }
32
33     final int getNumRpcs() {
34         return numRpcs;
35     }
36 }