/* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.mdsal.binding.api; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.binding.Rpc; /** * Provides access to registered Remote Procedure Call (RPC) service implementations. The RPCs are defined in YANG * models. {@link RpcProviderService} is this inferface's counterpart allowing registering RPC implementations. */ public interface RpcService extends BindingService { /** * Returns an implementation of a requested RPC service. * *
* The returned instance is not an actual implementation of the RPC service interface, but a proxy implementation of * the interface that forwards to an actual implementation, if any. * *
* The following describes the behavior of the proxy when invoking RPC methods: *
* The generated RPC method APIs require implementors to return a * {@link java.util.concurrent.Future Future} instance that wraps the * {@link org.opendaylight.yangtools.yang.common.RpcResult RpcResult}. Since RPC methods may be * implemented asynchronously, callers should avoid blocking on the * {@link java.util.concurrent.Future Future} result. Instead, it is recommended to use * {@link com.google.common.util.concurrent.JdkFutureAdapters#listenInPoolThread(java.util.concurrent.Future)} * or * {@link com.google.common.util.concurrent.JdkFutureAdapters#listenInPoolThread(java.util.concurrent.Future, * java.util.concurrent.Executor)} to listen for Rpc Result. This will asynchronously listen for future result * in executor and will not block current thread. * *
* final Future<RpcResult<SomeRpcOutput>> future = someRpc.invoke( ... ); * Futures.addCallback(JdkFutureAdapters.listenInThreadPool(future), new FutureCallback<RpcResult< * SomeRpcOutput>>() { * * public void onSuccess(RpcResult<SomeRpcOutput> result) { * // process result ... * } * * public void onFailure(Throwable t) { * // RPC failed * } * ); ** * @param