本文整理了Java中com.alibaba.dubbo.rpc.RpcResult.setValue
方法的一些代码示例,展示了RpcResult.setValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RpcResult.setValue
方法的具体详情如下:
包路径:com.alibaba.dubbo.rpc.RpcResult
类名称:RpcResult
方法名:setValue
暂无
代码示例来源:origin: liuyangming/ByteTCC
if (CompensableServiceFilter.InvocationResult.class.isInstance(value)) {
CompensableServiceFilter.InvocationResult wrapped = (CompensableServiceFilter.InvocationResult) value;
result.setValue(null);
result.setException(null);
result.setException(wrapped.getError());
} else {
result.setValue(wrapped.getValue());
if (resultInitRequired) {
if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_IDENTIFIER)) {
result.setValue(instanceId);
} else if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_APPLICATION)) {
result.setValue(CommonUtils.getApplication(instanceId));
} else if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_REMOTEADDR)) {
result.setValue(CommonUtils.getRemoteAddr(instanceId));
} else if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_REMOTENODE)) {
result.setValue(CommonUtils.getRemoteNode(instanceId));
代码示例来源:origin: liuyangming/ByteTCC
if (CompensableServiceFilter.InvocationResult.class.isInstance(value)) {
CompensableServiceFilter.InvocationResult wrapped = (CompensableServiceFilter.InvocationResult) value;
result.setValue(null);
result.setException(null);
result.setException(wrapped.getError());
} else {
result.setValue(wrapped.getValue());
if (resultInitRequired) {
if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_IDENTIFIER)) {
result.setValue(instanceId);
} else if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_APPLICATION)) {
result.setValue(CommonUtils.getApplication(instanceId));
} else if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_REMOTEADDR)) {
result.setValue(CommonUtils.getRemoteAddr(instanceId));
} else if (StringUtils.equals(invocation.getMethodName(), KEY_XA_GET_REMOTENODE)) {
result.setValue(CommonUtils.getRemoteNode(instanceId));
代码示例来源:origin: liuyangming/ByteTCC
public Result providerInvokeForKey(Invoker<?> invoker, Invocation invocation) throws RpcException {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator transactionCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
String instanceId = StringUtils.trimToEmpty(invocation.getAttachment(RemoteCoordinator.class.getName()));
this.registerRemoteParticipantIfNecessary(instanceId);
RpcResult result = new RpcResult();
CompensableServiceFilter.InvocationResult wrapped = new CompensableServiceFilter.InvocationResult();
wrapped.setVariable(RemoteCoordinator.class.getName(), transactionCoordinator.getIdentifier());
result.setException(null);
result.setValue(wrapped);
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
public Result providerInvokeForKey(Invoker<?> invoker, Invocation invocation) throws RpcException {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator transactionCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
String instanceId = StringUtils.trimToEmpty(invocation.getAttachment(RemoteCoordinator.class.getName()));
this.registerRemoteParticipantIfNecessary(instanceId);
RpcResult result = new RpcResult();
CompensableServiceFilter.InvocationResult wrapped = new CompensableServiceFilter.InvocationResult();
wrapped.setVariable(RemoteCoordinator.class.getName(), transactionCoordinator.getIdentifier());
result.setException(null);
result.setValue(wrapped);
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
public Result consumerInvokeForTCC(Invoker<?> invoker, Invocation invocation) throws RpcException, RemotingException {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator compensableCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
Map<String, String> attachments = invocation.getAttachments();
attachments.put(RemoteCoordinator.class.getName(), compensableCoordinator.getIdentifier());
RpcResult result = (RpcResult) invoker.invoke(invocation);
Object value = result.getValue();
if (CompensableServiceFilter.InvocationResult.class.isInstance(value)) {
CompensableServiceFilter.InvocationResult wrapped = (CompensableServiceFilter.InvocationResult) value;
result.setValue(null);
result.setException(null);
if (wrapped.isFailure()) {
result.setException(wrapped.getError());
} else {
result.setValue(wrapped.getValue());
}
}
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
public Result consumerInvokeForTCC(Invoker<?> invoker, Invocation invocation) throws RpcException, RemotingException {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator compensableCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
Map<String, String> attachments = invocation.getAttachments();
attachments.put(RemoteCoordinator.class.getName(), compensableCoordinator.getIdentifier());
RpcResult result = (RpcResult) invoker.invoke(invocation);
Object value = result.getValue();
if (CompensableServiceFilter.InvocationResult.class.isInstance(value)) {
CompensableServiceFilter.InvocationResult wrapped = (CompensableServiceFilter.InvocationResult) value;
result.setValue(null);
result.setException(null);
if (wrapped.isFailure()) {
result.setException(wrapped.getError());
} else {
result.setValue(wrapped.getValue());
}
// String propagatedBy = (String) wrapped.getVariable(RemoteCoordinator.class.getName());
// String identifier = compensableCoordinator.getIdentifier();
}
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
private Result convertResultForProvider(RpcResult result, String propagatedBy, boolean attachRequired) {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator compensableCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
Object value = result.getValue();
CompensableServiceFilter.InvocationResult wrapped = new CompensableServiceFilter.InvocationResult();
wrapped.setValue(value);
if (attachRequired) {
wrapped.setVariable(Propagation.class.getName(), propagatedBy);
wrapped.setVariable(RemoteCoordinator.class.getName(), compensableCoordinator.getIdentifier());
}
result.setException(null);
result.setValue(wrapped);
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
private Result convertResultForProvider(RpcResult result, String propagatedBy, boolean attachRequired) {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator compensableCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
Object value = result.getValue();
CompensableServiceFilter.InvocationResult wrapped = new CompensableServiceFilter.InvocationResult();
wrapped.setValue(value);
if (attachRequired) {
wrapped.setVariable(Propagation.class.getName(), propagatedBy);
wrapped.setVariable(RemoteCoordinator.class.getName(), compensableCoordinator.getIdentifier());
}
result.setException(null);
result.setValue(wrapped);
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
private Result createErrorResultForProvider(Throwable throwable, String propagatedBy, boolean attachRequired) {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator compensableCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
RpcResult result = new RpcResult();
CompensableServiceFilter.InvocationResult wrapped = new CompensableServiceFilter.InvocationResult();
wrapped.setError(throwable);
if (attachRequired) {
wrapped.setVariable(Propagation.class.getName(), propagatedBy);
wrapped.setVariable(RemoteCoordinator.class.getName(), compensableCoordinator.getIdentifier());
}
result.setException(null);
result.setValue(wrapped);
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
private Result createErrorResultForProvider(Throwable throwable, String propagatedBy, boolean attachRequired) {
CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator compensableCoordinator = (RemoteCoordinator) beanFactory.getCompensableNativeParticipant();
RpcResult result = new RpcResult();
CompensableServiceFilter.InvocationResult wrapped = new CompensableServiceFilter.InvocationResult();
wrapped.setError(throwable);
if (attachRequired) {
wrapped.setVariable(Propagation.class.getName(), propagatedBy);
wrapped.setVariable(RemoteCoordinator.class.getName(), compensableCoordinator.getIdentifier());
}
result.setException(null);
result.setValue(wrapped);
return result;
}
代码示例来源:origin: liuyangming/ByteTCC
result.setValue(wrapped);
return result;
result.setValue(wrapped);
} else {
TransactionContext transactionContext = transaction.getTransactionContext();
result.setValue(wrapped);
代码示例来源:origin: liuyangming/ByteTCC
result.setValue(wrapped);
return result;
result.setValue(wrapped);
} else {
TransactionContext transactionContext = transaction.getTransactionContext();
result.setValue(wrapped);
代码示例来源:origin: liuyangming/ByteTCC
if (CompensableServiceFilter.InvocationResult.class.isInstance(value)) {
CompensableServiceFilter.InvocationResult wrapped = (CompensableServiceFilter.InvocationResult) value;
result.setValue(null);
result.setException(null);
serverError = wrapped.getError();
} else {
result.setValue(wrapped.getValue());
代码示例来源:origin: liuyangming/ByteTCC
if (CompensableServiceFilter.InvocationResult.class.isInstance(value)) {
CompensableServiceFilter.InvocationResult wrapped = (CompensableServiceFilter.InvocationResult) value;
result.setValue(null);
result.setException(null);
serverError = wrapped.getError();
} else {
result.setValue(wrapped.getValue());
代码示例来源:origin: com.alibaba/dubbo-rpc-api
/**
* @see com.alibaba.dubbo.rpc.RpcResult#setValue(Object)
* @deprecated Replace to setValue()
*/
@Deprecated
public void setResult(Object result) {
setValue(result);
}
代码示例来源:origin: net.jahhan/dubbo-rpc-api
/**
* @deprecated Replace to setValue()
* @see com.alibaba.dubbo.rpc.RpcResult#setValue()
*/
@Deprecated
public void setResult(Object result) {
setValue(result);
}
代码示例来源:origin: com.alibaba/dubbo
/**
* @see com.alibaba.dubbo.rpc.RpcResult#setValue(Object)
* @deprecated Replace to setValue()
*/
@Deprecated
public void setResult(Object result) {
setValue(result);
}
代码示例来源:origin: remoting/dubbox
/**
* @deprecated Replace to setValue()
* @see com.alibaba.dubbo.rpc.RpcResult#setValue()
*/
@Deprecated
public void setResult(Object result) {
setValue(result);
}
代码示例来源:origin: remoting/dubbox
/**
* @deprecated Replace to setValue()
* @see com.alibaba.dubbo.rpc.RpcResult#setValue()
*/
@Deprecated
public void setResult(Object result) {
setValue(result);
}
代码示例来源:origin: liuyangming/ByteJTA
public Result providerInvokeForKey(Invoker<?> invoker, Invocation invocation) throws RpcException {
TransactionBeanRegistry beanRegistry = TransactionBeanRegistry.getInstance();
TransactionBeanFactory beanFactory = beanRegistry.getBeanFactory();
RemoteCoordinator transactionCoordinator = (RemoteCoordinator) beanFactory.getNativeParticipant();
String instanceId = StringUtils.trimToEmpty(invocation.getAttachment(RemoteCoordinator.class.getName()));
this.registerRemoteParticipantIfNecessary(instanceId);
RpcResult result = new RpcResult();
InvocationResult wrapped = new InvocationResult();
wrapped.setVariable(RemoteCoordinator.class.getName(), transactionCoordinator.getIdentifier());
result.setException(null);
result.setValue(wrapped);
return result;
}
内容来源于网络,如有侵权,请联系作者删除!