Y
yay_frogs
I'm writing a method that needs to:
1. Open a local file as a FileInputStream.
2. Lock the local file.
3. Upload the local file to a remote location.
4. Delete the local file.
5. Release the lock.
Now it seems it is impossible to do this with the existing java.nio.*
FileChannel and FileLock classes. There is no way to delete a locked
file. Once the locked file is uploaded to the server, I can't afford to
release the lock and let some other process accidentally try to access
the local file before my process deletes it. What can I do?
1. Open a local file as a FileInputStream.
2. Lock the local file.
3. Upload the local file to a remote location.
4. Delete the local file.
5. Release the lock.
Now it seems it is impossible to do this with the existing java.nio.*
FileChannel and FileLock classes. There is no way to delete a locked
file. Once the locked file is uploaded to the server, I can't afford to
release the lock and let some other process accidentally try to access
the local file before my process deletes it. What can I do?