In my post Check If File Is Available I showed a code using the Java method canWrite() to check if the file was available to be worked (read/write). Our colleague Marco Antonio commented that it could cause a race condition, so it is not a good idea to use it for that purpose.
Here is a link to a discussion where you can find more information: StockOverflow
Thanks for the useful info. It’s so interesting