Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

runtime.getRuntime().exec()  RSS feed

 
Suri bob
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys I need your immediate response.

I have been trying since 2 days without resolving the issue.
in my servlet i am executing a service with the help of sh command through runtime.getRuntime().exec().This service is taking more than 2 minutes, before completion of the service i am getting a request again. so my servlet is executing twice for 1 manual request.

what i am thinking :

when the server does not respond for a fixed amount of time.either the server should request the servlet again or browser will request the servlet automatically.

Now I need to stop the auto request.which header should i set or is there any tomcat server configuration i shud look into.

please respond.
 
Scott Selikoff
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried writing incremental output in the server to prevent the browser from quitting? You can use out.print() and call out.flush() to get the output to appear to the user while the servlet is still running. You might want to consider a asynchronous solution, though, as the process your describing is prone to errors.

(by asynchronous I mean the servlet spawns a thread and returns immediately, then you just have to hit refresh or use meta-refresh html tag to view the current status of the job).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott Selikoff:

(by asynchronous I mean the servlet spawns a thread and returns immediately, then you just have to hit refresh or use meta-refresh html tag to view the current status of the job).


I have an example app that does just this if you're interested.
See:
http://simple.souther.us/not-so-simple.html
Look for LongRunningProcess
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, Ajax might solve your problem if you can use it.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!