开发者

Background thread Tomcat Struts2

I have a web application using struts2 and tomcat 6 as a server. I have to do some logic that is in a jar file, but this take some time to finish. That's why I want to send the data from the execute method to that class in a separate thread, because if I use the class in the execute method I have to wait until all the logic is finished.

I've tried with execAndWait interceptor, the logic is in a separate thread, but I can't do anything in my application until that thread is fi开发者_如何学编程nished (because of the per-session of execAndWait).

I want to know if there's another way to process the logic in another thread?

Thanks in advance


You can use the Executor Framework that was added in Java 5.


If you're using Struts2 with Spring you could use the Spring TaskExecutor.

http://static.springsource.org/spring/docs/2.0.x/reference/scheduling.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜