• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stopping a servlet

 
kris reddy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have to develop a servlet(say servlet name is "test") that has to generate a html output by parsing a text file on the server. The text file at times may be in the middle of an update, by another process. So is there a way I to put the servlet to sleep for a while and then parse the text file?
Will a java bean be of any use?
I would really appreciate the help on this.
Thanks,
kris.
 
saumil shukla
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this situation your web service is near real time and not real time. I would move parsing to the processes which is writing it. There by better efficiency and no need to reparse for each request that comes in;unless your parsing is dependent on parameters passed in by the request.
Secondly, I would create file with different name and then using cp (copy) copy it to the filename to which webserver will use. Thus will have minimum hiccups. Third option if you are running a
version control is to checkout that file for edit update it checkback in and then checkout (non -edit) at the location of the webserver. This can also provide historical changes in the file.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"kris9542"-
Welcome to the JavaRanch! Please adjust your displayed name to match the JavaRanch Naming Policy.
You can change it here.
Thanks! and again welcome to the JavaRanch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!