java - Safe way to delete pdf files while showing on the screen -
i have method calls method opens saved pdf file screen swingutilities thread mechanism. while opens pdf file given client path, rest of method deals cleaning pdf files folder.
my problem if call method numerous times open several pdf files @ same time, best way clean path contains pdf files in terms of memory management.
my code snippet looks like:
public void filesavefinished(string filepath){ openpdfreport(filepath); //display pdf screen cleanfoldercontent(folderpath, filepath); // cleans folder contents except given filepath} public void opendpdfreport(string filepath){ swingutilities.invokelater(new runnable(){ pdffilelauncher.open(filepath); } }
here question related shared resources. read pdf , delete same. must go method pooling , use wait , notify method manage working. wait till file read operation not completed , notify same delete file. more details of wait , notify please tutorials. surely solve problem.
Comments
Post a Comment