Migrate rpcbenchmark to OSGi DS
[controller.git] / benchmark / rpcbenchmark / src / main / java / rpcbenchmark / impl / RoutedBindingRTCServer.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 java.util.Set;
11 import org.opendaylight.mdsal.binding.api.RpcProviderService;
12 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RpcbenchPayloadService;
13 import org.opendaylight.yangtools.concepts.Registration;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15
16 final class RoutedBindingRTCServer extends AbstractRpcbenchPayloadService implements AutoCloseable {
17     private final Registration reg;
18
19     RoutedBindingRTCServer(final RpcProviderService rpcProvider, final Set<InstanceIdentifier<?>> paths) {
20         reg = rpcProvider.registerRpcImplementation(RpcbenchPayloadService.class, this, paths);
21     }
22
23     @Override
24     public void close() {
25         reg.close();
26     }
27 }