public class BindingDOMRpcServiceAdapter extends Object implements RpcConsumerRegistry
Modifier and Type | Field and Description |
---|---|
protected static org.opendaylight.controller.md.sal.binding.impl.BindingDOMAdapterBuilder.Factory<RpcConsumerRegistry> |
BUILDER_FACTORY |
Constructor and Description |
---|
BindingDOMRpcServiceAdapter(DOMRpcService domService,
BindingToNormalizedNodeCodec codec) |
Modifier and Type | Method and Description |
---|---|
<T extends org.opendaylight.yangtools.yang.binding.RpcService> |
getRpcService(Class<T> rpcService)
Returns an implementation of a requested RPC service.
|
protected static final org.opendaylight.controller.md.sal.binding.impl.BindingDOMAdapterBuilder.Factory<RpcConsumerRegistry> BUILDER_FACTORY
public BindingDOMRpcServiceAdapter(DOMRpcService domService, BindingToNormalizedNodeCodec codec)
public <T extends org.opendaylight.yangtools.yang.binding.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.Copyright © 2019 OpenDaylight. All rights reserved.