Open wsky opened 11 years ago
direct use channel to send, and using same binary protocol currently:
DynamicProxy.java:
public MethodReturn invoke(MethodCall methodCall, int executionTimeoutMillisecond) throws RemotingException, FormatterException { SynchronizedRemotingCallback syncCallback = new SynchronizedRemotingCallback(); HashMap<String, Object> transportHeaders = new HashMap<String, Object>(); transportHeaders.put(TcpTransportHeader.RequestUri, this.uriString); ClientChannel channel = this.getChannel(); try { return this.send(channel, this.channelHandler.pending(syncCallback, TcpOperations.Request, transportHeaders, methodCall), syncCallback, executionTimeoutMillisecond); } finally { this.selector.returnChannel(channel); } }
but, via http, restful is better, and text protocol needed.
private ClientChannel getChannel() throws RemotingException { try { ClientChannel channel = this.selector.getChannel(this.remoteUri); channel.setChannelHandler(channelHandler); return channel; } catch (ChannelException e) { throw new RemotingException(Text.RPC_CAN_NOT_GET_CHANNEL, e); } }
change to:
getRemotingChannelSink(uri).send(methodCall);
remoting codec can be extend.
json support also needed https://github.com/douglascrockford/JSON-java
direct use channel to send, and using same binary protocol currently:
DynamicProxy.java:
but, via http, restful is better, and text protocol needed.
change to:
remoting codec can be extend.