当前位置: 首页>>代码示例>>Java>>正文


Java RpcResult.isSuccessful方法代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.common.RpcResult.isSuccessful方法的典型用法代码示例。如果您正苦于以下问题:Java RpcResult.isSuccessful方法的具体用法?Java RpcResult.isSuccessful怎么用?Java RpcResult.isSuccessful使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yangtools.yang.common.RpcResult的用法示例。


在下文中一共展示了RpcResult.isSuccessful方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
@Override
public void close() {
    if(this.listenerRegistration != null){
        this.listenerRegistration.close();
    }
    for(final InstanceIdentifier<?> eventSourceNodeId : joinedEventSources){
        try {
            final RpcResult<Void> result = sourceService.disJoinTopic(getDisJoinTopicInputArgument(eventSourceNodeId)).get();
            if(result.isSuccessful() == false){
                for(final RpcError err : result.getErrors()){
                    LOG.error("Can not destroy topic: [{}] on node: [{}]. Error: {}",getTopicId().getValue(),eventSourceNodeId,err.toString());
                }
            }
        } catch (InterruptedException | ExecutionException ex) {
            LOG.error("Can not close event source topic / destroy topic {} on node {}.", this.topicId.getValue(), eventSourceNodeId, ex);
        }
    }
    joinedEventSources.clear();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:EventSourceTopic.java

示例2: transform

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
private DOMRpcResult transform(final RpcResult<?> input) {
    if (input.isSuccessful()) {
        final Object inputData = input.getResult();
        if (inputData instanceof DataContainer) {
            return new DefaultDOMRpcResult(codec.toNormalizedNodeRpcData((DataContainer) inputData));
        } else {
            return new DefaultDOMRpcResult((NormalizedNode<?, ?>) null);
        }
    }
    return new DefaultDOMRpcResult(input.getErrors());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:LazyDOMRpcResultFuture.java

示例3: makeScrambledWithWheat

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
@Override
public Boolean makeScrambledWithWheat() {
    try {
        // This call has to block since we must return a result to the JMX client.
        RpcResult<Void> result = makeBreakfast(EggsType.SCRAMBLED, WheatBread.class, 2).get();
        if (result.isSuccessful()) {
            LOG.info("makeBreakfast succeeded");
        } else {
            LOG.warn("makeBreakfast failed: " + result.getErrors());
        }

        return result.isSuccessful();

    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("An error occurred while maing breakfast: " + e);
    }

    return Boolean.FALSE;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:KitchenServiceImpl.java

示例4: runTest

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
public void runTest(final int iterations) {
    int rpcOk = 0;
    int rpcError = 0;

    for (int i = 0; i < iterations; i++) {
        Future<RpcResult<GlobalRpcBenchOutput>> output = service.globalRpcBench(inVal);
        try {
            RpcResult<GlobalRpcBenchOutput> rpcResult = output.get();

            if (rpcResult.isSuccessful()) {
                List<Payload> retVal = rpcResult.getResult().getPayload();
                if (retVal.size() == inSize) {
                    rpcOk++;
                }
                else {
                    rpcError++;
                }
            }
        } catch (InterruptedException | ExecutionException e) {
            rpcError++;
            LOG.error("Execution failed: ", e);
        }
    }

    this.rpcOk.addAndGet(rpcOk);
    this.rpcError.addAndGet(rpcError);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:28,代码来源:GlobalBindingRTCClient.java

示例5: runTest

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
public void runTest(final int iterations) {
    int rpcOk = 0;
    int rpcError = 0;

    int rpcServerCnt = inVal.size();
    for (int i = 0; i < iterations; i++) {
        RoutedRpcBenchInput input = inVal.get(ThreadLocalRandom.current().nextInt(rpcServerCnt));
        Future<RpcResult<RoutedRpcBenchOutput>> output = service.routedRpcBench(input);
        try {
            RpcResult<RoutedRpcBenchOutput> rpcResult = output.get();

            if (rpcResult.isSuccessful()) {
                List<Payload> retVal = rpcResult.getResult().getPayload();
                if (retVal.size() == inSize) {
                    rpcOk++;
                }
                else {
                    rpcError++;
                }
            }
        } catch (InterruptedException | ExecutionException e) {
            rpcError++;
            LOG.error("Execution failed: ", e);
        }
    }

    this.rpcOk.addAndGet(rpcOk);
    this.rpcError.addAndGet(rpcError);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:30,代码来源:RoutedBindingRTClient.java

示例6: notifyNode

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
public void notifyNode(final InstanceIdentifier<?> nodeId) {
    LOG.debug("Notify node: {}", nodeId);
    try {
        final RpcResult<JoinTopicOutput> rpcResultJoinTopic = sourceService.joinTopic(getJoinTopicInputArgument(nodeId)).get();
        if(rpcResultJoinTopic.isSuccessful() == false){
            for(final RpcError err : rpcResultJoinTopic.getErrors()){
                LOG.error("Can not join topic: [{}] on node: [{}]. Error: {}",getTopicId().getValue(),nodeId.toString(),err.toString());
            }
        } else {
            joinedEventSources.add(nodeId);
        }
    } catch (final Exception e) {
        LOG.error("Could not invoke join topic for node {}", nodeId);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:EventSourceTopic.java

示例7: verifySuccessfulRpcResult

import org.opendaylight.yangtools.yang.common.RpcResult; //导入方法依赖的package包/类
private static <T> T verifySuccessfulRpcResult(RpcResult<T> rpcResult) {
    if (!rpcResult.isSuccessful()) {
        if (rpcResult.getErrors().size() > 0) {
            RpcError error = Iterables.getFirst(rpcResult.getErrors(), null);
            throw new AssertionError("Rpc failed with error: " + error, error.getCause());
        }

        fail("Rpc failed with no error");
    }

    return rpcResult.getResult();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:ClusterAdminRpcServiceTest.java


注:本文中的org.opendaylight.yangtools.yang.common.RpcResult.isSuccessful方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。