質問

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?

役に立ちましたか?

解決

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.)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top