修改wrapper类

git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@124 1a56cb94-b969-4eaa-88fa-be21384802f2
This commit is contained in:
william.liangf 2011-10-28 08:48:19 +00:00
parent 022deac62c
commit 51b66f26ee
1 changed files with 4 additions and 5 deletions

View File

@ -31,6 +31,7 @@ import com.alibaba.dubbo.rpc.Result;
import com.alibaba.dubbo.rpc.RpcConstants;
import com.alibaba.dubbo.rpc.RpcException;
import com.alibaba.dubbo.rpc.RpcInvocation;
import com.alibaba.dubbo.rpc.RpcResult;
import com.alibaba.dubbo.rpc.protocol.AbstractInvoker;
/**
@ -61,19 +62,18 @@ public class ChannelWrappedInvoker<T> extends AbstractInvoker<T> {
inv.setAttachment(RpcConstants.CALLBACK_SERVICE_KEY, serviceKey);
ExchangeClient currentClient = new HeaderExchangeClient(new ChannelWrapper(this.channel));
Result result;
try {
if (getUrl().getMethodBooleanParameter(invocation.getMethodName(), Constants.ASYNC_KEY)) { // 不可靠异步
currentClient.send(inv,getUrl().getMethodBooleanParameter(invocation.getMethodName(), Constants.SENT_KEY));
return null;
return new RpcResult();
}
int timeout = getUrl().getMethodIntParameter(invocation.getMethodName(),
Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
if (timeout > 0) {
result = (Result) currentClient.request(inv, timeout).get();
return (Result) currentClient.request(inv, timeout).get();
} else {
result = (Result) currentClient.request(inv).get();
return (Result) currentClient.request(inv).get();
}
} catch (RpcException e) {
throw e;
@ -84,7 +84,6 @@ public class ChannelWrappedInvoker<T> extends AbstractInvoker<T> {
} catch (Throwable e) { // here is non-biz exception, wrap it.
throw new RpcException(e.getMessage(), e);
}
return result;
}
public static class ChannelWrapper extends ClientDelegate {