• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

runtime.getRuntime().exec()

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think, Ajax might solve your problem if you can use it.
 
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic