Bump upstream versions
[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.RpcbenchPayloadService;
12 import org.opendaylight.yangtools.concepts.Registration;
13 import org.osgi.service.component.annotations.Reference;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 final class GlobalBindingRTCServer extends AbstractRpcbenchPayloadService implements AutoCloseable {
18     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCServer.class);
19
20     private final Registration reg;
21
22     GlobalBindingRTCServer(@Reference final RpcProviderService rpcProvider) {
23         reg = rpcProvider.registerRpcImplementation(RpcbenchPayloadService.class, this);
24         LOG.debug("GlobalBindingRTCServer started");
25     }
26
27     @Override
28     public void close() {
29         reg.close();
30         LOG.debug("GlobalBindingRTCServer stopped");
31     }
32 }