public class BindingDOMRpcServiceAdapter extends Object implements RpcConsumerRegistry
Modifier and Type | Field and Description |
---|---|
protected static org.opendaylight.mdsal.binding.dom.adapter.BindingDOMAdapterBuilder.Factory<RpcConsumerRegistry> |
BUILDER_FACTORY |
Constructor and Description |
---|
BindingDOMRpcServiceAdapter(DOMRpcService domService,
BindingToNormalizedNodeCodec codec) |
Modifier and Type | Method and Description |
---|---|
protected BindingToNormalizedNodeCodec |
getCodec() |
T |
getDelegate() |
<T extends RpcService> |
getRpcService(Class<T> rpcService)
Returns an implementation of a requested RPC service.
|
protected static final org.opendaylight.mdsal.binding.dom.adapter.BindingDOMAdapterBuilder.Factory<RpcConsumerRegistry> BUILDER_FACTORY
public BindingDOMRpcServiceAdapter(DOMRpcService domService, BindingToNormalizedNodeCodec codec)
public <T extends RpcService> T getRpcService(Class<T> rpcService)
RpcConsumerRegistry
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:
IllegalStateException
.IllegalArgumentException
is thrown.
The generated RPC method APIs require implementors to return a
Future
instance that wraps the
RpcResult
. Since RPC methods may be
implemented asynchronously, callers should avoid blocking on the
Future
result. Instead, it is recommended to use
JdkFutureAdapters.listenInPoolThread(java.util.concurrent.Future)
or
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 = someRpcService.someRpc( ... ); Futures.addCallback(JdkFutureAdapters.listenInThreadPool(future), new FutureCallback<RpcResult< SomeRpcOutput>>() { public void onSuccess(RpcResult<SomeRpcOutput> result) { // process result ... } public void onFailure(Throwable t) { // RPC failed } );
getRpcService
in interface RpcConsumerRegistry
rpcService
- the interface of the RPC Service. Typically this is an interface
generated from a YANG model.public final T getDelegate()
getDelegate
in interface org.opendaylight.yangtools.concepts.Delegator<T>
protected final BindingToNormalizedNodeCodec getCodec()
Copyright © 2019 OpenDaylight. All rights reserved.