Search in sources :

Example 6 with ClusteringRpcException

use of org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException in project netconf by opendaylight.

the class ActorProxyNetconfServiceFacade method unlock.

@Override
public ListenableFuture<DOMRpcResult> unlock() {
    LOG.debug("{}: Unlock via actor {}", id, masterActor);
    final SettableFuture<DOMRpcResult> unlockResult = SettableFuture.create();
    final Future<Object> future = Patterns.ask(masterActor, new UnlockRequest(), askTimeout);
    future.onComplete(new OnComplete<>() {

        @Override
        public void onComplete(final Throwable failure, final Object response) {
            if (failure != null) {
                unlockResult.setException(failure);
            } else if (response instanceof InvokeRpcMessageReply) {
                unlockResult.set(mapInvokeRpcMessageReplyToDOMRpcResult((InvokeRpcMessageReply) response));
            } else {
                unlockResult.setException(new ClusteringRpcException("Unlock operation returned unexpected type"));
                LOG.error("{}: Unlock via actor {} returned unexpected type", id, masterActor);
            }
        }
    }, executionContext);
    return unlockResult;
}
Also used : DefaultDOMRpcResult(org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult) DOMRpcResult(org.opendaylight.mdsal.dom.api.DOMRpcResult) UnlockRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.UnlockRequest) ClusteringRpcException(org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException) InvokeRpcMessageReply(org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessageReply)

Aggregations

DOMRpcResult (org.opendaylight.mdsal.dom.api.DOMRpcResult)6 DefaultDOMRpcResult (org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult)6 ClusteringRpcException (org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException)6 InvokeRpcMessageReply (org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessageReply)4 RpcError (org.opendaylight.yangtools.yang.common.RpcError)2 Collection (java.util.Collection)1 ExecutionException (java.util.concurrent.ExecutionException)1 Test (org.junit.Test)1 DOMRpcException (org.opendaylight.mdsal.dom.api.DOMRpcException)1 DOMRpcService (org.opendaylight.mdsal.dom.api.DOMRpcService)1 NormalizedNodeMessage (org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage)1 SchemaPathMessage (org.opendaylight.netconf.topology.singleton.messages.SchemaPathMessage)1 CommitRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.CommitRequest)1 DiscardChangesRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.DiscardChangesRequest)1 LockRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.LockRequest)1 UnlockRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.UnlockRequest)1 InvokeRpcMessage (org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessage)1 EmptyResultResponse (org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyResultResponse)1 QName (org.opendaylight.yangtools.yang.common.QName)1 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)1