Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Possible to force file lock release?

843811Mar 30 2004 — edited Apr 2 2004
Is there any way to force the JVM to release a lock on a certain file?

I am reading from a BufferedReader wrapped around a FileReader. At some point, an IOException is thrown (I'm reading a file that is being written by another process, and occaisonally this will happen, but I'm handling it so it doesn't really bother me). When this happens, I can not call reader.close(), the lock never gets released, and I can never delete the file I was reading from.

So I'm wondering if there is some way to force it to be unlocked. Ideally a static method like

FileLock.releaseLock(File pleaseReleaseMeLetMeGo)


?????
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2004
Added on Mar 30 2004
7 comments
599 views