use of com.alibaba.dubbo.remoting.exchange.support.ReplierDispatcher in project dubbo by alibaba.
the class Main method startServer.
private static void startServer(int port) throws Exception {
ReplierDispatcher dispatcher = new ReplierDispatcher();
dispatcher.addReplier(RpcMessage.class, new RpcMessageHandler());
dispatcher.addReplier(Object.class, new Replier<Object>() {
public Object reply(ExchangeChannel channel, Object msg) {
for (int i = 0; i < 10000; i++) System.currentTimeMillis();
System.out.println("handle:" + msg + ";thread:" + Thread.currentThread().getName());
return new StringMessage("hello world");
}
});
Exchangers.bind(URL.valueOf("dubbo://localhost:" + port), dispatcher);
}
Aggregations