Examples of AsyncService


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

Examples of org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncService

        return test;
    }

    private AsyncPort getPort() {

        AsyncService service = new AsyncService();
        AsyncPort port = service.getAsyncPort();
        assertNotNull("Port is null", port);

        Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
        rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                DOCLITWR_ASYNC_ENDPOINT);
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncService

        return getPort(null);
    }
   
    private AsyncPort getPort(WebServiceFeature... features) {

        AsyncService service = new AsyncService();
        AsyncPort port = service.getAsyncPort(features);
        assertNotNull("Port is null", port);

        Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
        rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                DOCLITWR_ASYNC_ENDPOINT);
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncService

        return getPort(null);
    }
   
    private AsyncPort getPort(WebServiceFeature... features) {

        AsyncService service = new AsyncService();
        AsyncPort port = service.getAsyncPort(features);
        assertNotNull("Port is null", port);

        Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
        rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                DOCLITWR_ASYNC_ENDPOINT);
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncService

        return getPort(null);
    }
   
    private AsyncPort getPort(WebServiceFeature... features) {

        AsyncService service = new AsyncService();
        AsyncPort port = service.getAsyncPort(features);
        assertNotNull("Port is null", port);

        Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
        rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                DOCLITWR_ASYNC_ENDPOINT);
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService

    public void testService_ExecutorShutdownNow() throws Exception {
        final String MESSAGE = "testExecutorShutdownNow";

        String title = myClassName + " : " + getName() + " : ";

        AsyncService service = getService(null);
        AsyncPort port = getPort(service);

    // get the default executor and check to make sure it is an executor service
        ExecutorService ex = null;
        Executor executor = service.getExecutor();
        if ((executor != null) && (executor instanceof ExecutorService))
        {
            ex = (ExecutorService) executor;
        }
        else
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService

    public void testService_ExecutorShutdownNow_2() throws Exception {
        final String MESSAGE = "testExecutorShutdownNow_2";

        String title = myClassName + " : " + getName() + " : ";

        AsyncService service = getService(null);
        AsyncPort port = getPort(service);

    // get the default executor and check to make sure it is an executor service
    ExecutorService ex = Executors.newSingleThreadExecutor();
    service.setExecutor(ex);


        // submit a request to the server that will wait until we ask for it
    CallbackHandler<SleepResponse> sleepCallbackHandler1 = new CallbackHandler<SleepResponse>();
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService

    public void testService_ExecutorShutdownNow_3() throws Exception {
        final String MESSAGE = "testExecutorShutdownNow_3";

        String title = myClassName + " : " + getName() + " : ";

        AsyncService service = getService(null);
        AsyncPort port = getPort(service);

    // get the default executor and check to make sure it is an executor service
        ExecutorService ex = null;
        Executor executor = service.getExecutor();
        if ((executor != null) && (executor instanceof ExecutorService))
        {
            ex = (ExecutorService) executor;

            // tell the executor to shutdown immediately, which
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService

        return true;
    }
   

    private AsyncService getService(Executor ex) {
        AsyncService service = new AsyncService();

        if (ex!= null)
            service.setExecutor(ex);
       
        if (service.getExecutor() == null)
        {
            TestLogger.logger.debug(myClassName + " : getService() : executor is null");
        }
        else
        {
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService

    /**
     * Auxiliary method used for obtaining a proxy pre-configured with a
     * specific Executor
     */
    private AsyncPort getPort(Executor ex) {
        AsyncService service = getService(ex);

        AsyncPort port = service.getAsyncPort();
        assertNotNull("Port is null", port);

        Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
        rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                DOCLITWR_ASYNC_ENDPOINT);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.