问题
I have one Grails working on the server on Tomcat. This app is an web interface to export information from the MySQL server. This information can be exported depending on the selection that you did, but takes some time. The biggest part or process is around 40min. This is the time that it needs to export all the information from the database and return to user compressed in one zip file.
Everything is working correctly but we have a problem with one client. They have some kind of proxy installed and after 3 minutes of inactivity closes the connection with the server and he is not enable to export anything because all the combinations that he can select to export take longer.
The client side, the GSP page, doesn't do anything while the server side is calculating and creating the compressed file, is only waiting. What can I do to avoid this closing of the connection?
This is the message that is receiving the client:
Network Error (tcp_error) A communication error occurred: "" Detailed technical information: URL: **** Proxy: fe0psg03 Client Adress: 10.2.122.105 Time: [15/10/2012:15:41:40 GMT] User: DE\roklinne The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
Thanks in advance for your support,
回答1:
Because this process is taking up to 40mins. I would consider spinning off a task and running it in the background.
couple of suggestions...
1) just use the Java 5 concurrency classes (little extra work)
2) JSR-166y library giving you handy abstractions for Fork/Join and Parallel Array.
3) The Background thread Grails plugin
The after this you could have a progress bar and give the user an update on how things are going.
来源:https://stackoverflow.com/questions/12932136/how-to-avoid-client-firewall-closing-connection-because-inactivity-while-process