Search in sources :

Example 6 with InvokeRpcMessageReply

use of org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessageReply 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

InvokeRpcMessageReply (org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessageReply)6 DOMRpcResult (org.opendaylight.mdsal.dom.api.DOMRpcResult)5 DefaultDOMRpcResult (org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult)4 ClusteringRpcException (org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException)4 Status (akka.actor.Status)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