Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

very strange problem in file deleting  RSS feed

 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If i create a file (in a servlet) and try to delete it witn in some seconds ( when control reaches to another servlet)It do not delete it and if i wait for some time then it happily deletes it Am i missing something somewhere? Is it related to some threading issue
Moderators Pls tell something
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us the code.
 
Noah Carroll
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the code will help, but the first thing I thought of was how operating systems handle file sharing. If you have a file open in one program you cannot open it in another. The servlet that created the file may not have released it back to the operating system, therefore the operating system will not allow anything else access to it. So just waiting does help due to Java's garbage collection process.
 
kunal shah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i think u should close the file object before deleting the file
 
karan, chopra
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gaurav Chikara:

If i create a file (in a servlet) and try to delete it witn in some seconds ( when control reaches to another servlet)It do not delete it and if i wait for some time then it happily deletes it Am i missing something somewhere? Is it related to some threading issue
Moderators Pls tell something

hey gaurav,i want to do the same thing that u did,so can u please share the code of file deletion with me..please..its very urgent..i would really appreciate that..
regards
karan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!