Question

I need to call a RESTful service from struts action class but this RESTful service is taking about half an hour time to complete(series of hadoop jobs). Thus blocking the response from struts action. How can I call the RESTful service without blocking the struts response?

Était-ce utile?

La solution

You can call the RESTful Service asynchronously, in separate thread. For example the following code

Thread th=new Thread(new Runnable() {
              @Override
              public void run() {
                // Code calling the RESTful service
              }
            });
        th.start();

    }

will execute in a separate thread without blocking the main thread (request thread in your case.)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top