문제

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