0

My application is using Struts 1.x and it's running on WAS..

All action classes are working fine except one wherein I click on one button and one action(which is expected to complete in 1hour) is called and then it starts executing ..the issue comes when same action is called after few minutes without any button trigger or any change of code.This happens after every few minutes for n number of times...

If anyone has any idea about this please let me know.

dario
  • 5,149
  • 12
  • 28
  • 32
androidDev
  • 1,179
  • 4
  • 13
  • 31
  • Are you using IBM HTTP server or other web server with WebSphere Plugin configured? – Gas Jul 08 '15 at 19:49

1 Answers1

0

A request that takes 1 hour to complete is not normal: you should redesign this functionality.

Briefly, you have this problem because the request takes too much time to complete. For a technical explanation of the cause of your problem see Why does the user agent resubmit a request after server does a TCP reset?

Solution: create a separate thread (or a pool of parallel threads, if possible) to handle the long-running computation and send immediately a response page saying "Request accepted". This page could also use JavaScript to send periodically an "is it completed?" request to the server. You should also provide a mechanism to inquiry for pending requests, so users that close the browser without waiting for the final "Yes, completed!" response can get the result when they want.

Community
  • 1
  • 1
Pino
  • 7,468
  • 6
  • 50
  • 69
  • I believe you are referring to creating a thread inside execute method...but that execute method itself is being called multiple times – androidDev Jul 07 '15 at 11:32
  • The method is called multiple times because it takes too much (see the link in my answer). If you create a separate thread for the long-running computation, the Struts' action can terminate very quickly without waiting for the other thread. – Pino Jul 07 '15 at 11:35
  • But its not waiting so long ..execute method is being called after every 5 min..and this scenario is repeating around 9-10 times – androidDev Jul 07 '15 at 13:07
  • When talking of response times of a web application, five seconds is not so long (but many people would not agree), five minutes is very long and 1 hour is like waiting forever. Five minutes is also the same timeout described in the other page I linked. You have really to resign yourself and use a separate thread for the long-running computation. – Pino Jul 08 '15 at 07:27