本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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();
}