Improve your WEBServices Consumer Apps Making WS Invocations in Parallel

If your application is calling several WS and there is no need to do it in serial, you can implement a multithreaded approach:

calling ws in parallel


Class1Service class1Service = new Class1Service();

        x = class1Service.getClass1Port();

        setWSTimeout(x); // esto lo veremos en la siguiente seccion

        class Task implements Callable<Object> {

             private Object result;

             public Object call() {

                  // compute result




                  catch (Exception e){



                  return result;



        Task c1 = new Task();

        Task c2 = new Task();

        ExecutorService exec = Executors.newFixedThreadPool(2);

        Future<Object> f1 = exec.submit(c1);

        Future<Object> f2 = exec.submit(c2);





        catch(Exception e){



Enjoy 😉

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.