Forums Register Login

RandomAccessFile rws mode

+Pie Number of slices to send: Send
If I open the file in this mode does it mean I dont need to call Close() on it since the data is getting wrote to file?

Thanks.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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?

Thanks
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
A shutdown hook? Time for some investigating!!

Thank You all for your replies!
+Pie Number of slices to send: Send
Sorry if that was confusing, I just meant a method that you would call when the application was shutting down.
+Pie Number of slices to send: Send
shutdown hook?!

just create the random access file outside of your Data object, and pass it in as a construction parameter. Then you can close it any time you want.

- Adam
+Pie Number of slices to send: Send
Which then means that its not only your data class (and any classes that it delegates to) that knows that its a file based implementation.
Space pants. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 689 times.
Similar Threads
policy file
client & sever direcory under jre
DWR Security Exception
NV:where should creat,delete operation be?
does OS matter for ASCII file ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:06:45.