com.alibaba.dubbo.remoting.exchange.support.Replier Java Examples

The following examples show how to use com.alibaba.dubbo.remoting.exchange.support.Replier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #2
Source File: Main.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #3
Source File: Main.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #4
Source File: Main.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #5
Source File: Main.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #6
Source File: MockedClient.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public Replier<?> getReceiver() {
    return null;
}
 
Example #7
Source File: MockedClient.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void registerHandler(Replier<?> handler) {
    this.handler = handler;
}
 
Example #8
Source File: NettyClientToServerTest.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
protected ExchangeServer newServer(int port, Replier<?> receiver) throws RemotingException {
    return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=netty"), receiver);
}
 
Example #9
Source File: Exchangers.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(String url, Replier<?> replier) throws RemotingException {
    return bind(URL.valueOf(url), replier);
}
 
Example #10
Source File: Exchangers.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(String url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return connect(URL.valueOf(url), handler, replier);
}
 
Example #11
Source File: Exchangers.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(String url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return bind(URL.valueOf(url), handler, replier);
}
 
Example #12
Source File: Exchangers.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(URL url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return bind(url, new ExchangeHandlerDispatcher(replier, handler));
}
 
Example #13
Source File: Exchangers.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(String url, Replier<?> replier) throws RemotingException {
    return connect(URL.valueOf(url), new ChannelHandlerAdapter(), replier);
}
 
Example #14
Source File: Exchangers.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(URL url, Replier<?> replier) throws RemotingException {
    return connect(url, new ChannelHandlerAdapter(), replier);
}
 
Example #15
Source File: MinaClientToServerTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
protected ExchangeServer newServer(int port, Replier<?> receiver) throws RemotingException {
    return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=mina"), receiver);
}
 
Example #16
Source File: MockedClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void registerHandler(Replier<?> handler) {
    this.handler = handler;
}
 
Example #17
Source File: Exchangers.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(URL url,  Replier<?> replier) throws RemotingException {
    return bind(url, new ChannelHandlerAdapter(), replier);
}
 
Example #18
Source File: MockedClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void unregisterHandler(Replier<?> handler) {
    //this.handler = null;
}
 
Example #19
Source File: MockedClient.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Replier<?> getReceiver() {
    return null;
}
 
Example #20
Source File: MockedClient.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void unregisterHandler(Replier<?> handler) {
    //this.handler = null;
}
 
Example #21
Source File: Exchangers.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(URL url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return bind(url, new ExchangeHandlerDispatcher(replier, handler));
}
 
Example #22
Source File: MinaClientToServerTest.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Override
protected ExchangeServer newServer(int port, Replier<?> receiver) throws RemotingException {
    return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=mina"), receiver);
}
 
Example #23
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(URL url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return connect(url, new ExchangeHandlerDispatcher(replier, handler));
}
 
Example #24
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(String url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return connect(URL.valueOf(url), handler, replier);
}
 
Example #25
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(URL url, Replier<?> replier) throws RemotingException {
    return connect(url, new ChannelHandlerAdapter(), replier);
}
 
Example #26
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeClient connect(String url, Replier<?> replier) throws RemotingException {
    return connect(URL.valueOf(url), new ChannelHandlerAdapter(), replier);
}
 
Example #27
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(URL url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return bind(url, new ExchangeHandlerDispatcher(replier, handler));
}
 
Example #28
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(String url, ChannelHandler handler, Replier<?> replier) throws RemotingException {
    return bind(URL.valueOf(url), handler, replier);
}
 
Example #29
Source File: Exchangers.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static ExchangeServer bind(URL url,  Replier<?> replier) throws RemotingException {
    return bind(url, new ChannelHandlerAdapter(), replier);
}
 
Example #30
Source File: NettyClientToServerTest.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
protected ExchangeServer newServer(int port, Replier<?> receiver) throws RemotingException {
    return Exchangers.bind(URL.valueOf("exchange://localhost:" + port + "?server=netty"), receiver);
}