Package com.alibaba.dubbo.examples.async.api

Examples of com.alibaba.dubbo.examples.async.api.AsyncService


    public static void main(String[] args) throws Exception {
        String config = AsyncConsumer.class.getPackage().getName().replace('.', '/') + "/async-consumer.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
        context.start();
       
        final AsyncService asyncService = (AsyncService)context.getBean("asyncService");
       
        Future<String> f = RpcContext.getContext().asyncCall(new Callable<String>() {
            public String call() throws Exception {
                return asyncService.sayHello("async call request");
            }
        });
       
        System.out.println("async call ret :" + f.get());
       
        RpcContext.getContext().asyncCall(new Runnable() {
            public void run() {
                asyncService.sayHello("oneway call request1");
                asyncService.sayHello("oneway call request2");
            }
        });
       
        System.in.read();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.examples.async.api.AsyncService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.