Fix followerDistributedDataStore tear down
[controller.git] / benchmark / rpcbenchmark / src / main / java / rpcbenchmark / impl / GlobalBindingRTCServer.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 org.opendaylight.mdsal.binding.api.RpcProviderService;
11 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBench;
12 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBench;
13 import org.opendaylight.yangtools.concepts.Registration;
14 import org.osgi.service.component.annotations.Reference;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 final class GlobalBindingRTCServer extends AbstractRpcbenchPayloadService implements AutoCloseable {
19     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCServer.class);
20
21     private final Registration reg;
22
23     GlobalBindingRTCServer(@Reference final RpcProviderService rpcProvider) {
24         reg = rpcProvider.registerRpcImplementations(
25             (GlobalRpcBench) this::globalRpcBench,
26             (RoutedRpcBench) this::routedRpcBench);
27         LOG.debug("GlobalBindingRTCServer started");
28     }
29
30     @Override
31     public void close() {
32         reg.close();
33         LOG.debug("GlobalBindingRTCServer stopped");
34     }
35 }