i am reading data from MS-SQL6.5 DB and transferring those data into a XML file.The whole process is done by click of a button.While writing the data into the XML file,i want to provide the option of aborting that process.I use java IO to write data into the file.How can i achieve the functionality of aborting the "file writing" process?can anyone suggest godd program logic for this ?
Kindly reply back.
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
I suggest that you delegate the writing part to a dedicated thread. The run of that thread should be controlled by a boolean condition, like while(!buttonPressed). When you press the abort button you should switch the value of buttonPressed from false to true, thus aborting the thread. You should know, though, that this would let the file being written in a unknown state ! I think you don't care ! Let me know if it's not clear HIH ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform