You should always close your files, when you're not using them anymore, to release file pointers. Is there any reason that you don't want to close the file?
Hi there, No reason, but i think the only place i could do it is in the finalize() method of my data class. as far as i am aware this is pretty dodgy so was hoping i wouldnt need to do call close() at all. Is the risk of the finalize not being called large? What are the consequences of implementing it this way? Is there another way of safely doing this on server shutdown?
If you create an extension to the provided database interface, you could provide a shutdown hook which will close the file. You'd then reference this new interface throughout the application rather than the provided one.