Skip to Main Content

Java Programming

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!

File.renameTo acting slower

Alejandro Tovar LanzJan 27 2017 — edited Feb 17 2017

Hi,

We are using this method as part of automation process. After a lot of debugging we hit the head of the nail by isolating the call file file.renameTo(destFile);

Version 1.6

This is a PROD environment and it takes around 3 seconds to the the copy. In QA the same method goes through immediately. According to the documentation:

Many aspects of the behavior of this method are inherently

     * platform-dependent: The rename operation might not be able to move a

     * file from one filesystem to another, it might not be atomic, and it

     * might not succeed if a file with the destination abstract pathname

     * already exists.  The return value should always be checked to make sure

     * that the rename operation was successful.

So this may be an issue of the OS rather than the java class.

Any idea how to go about this?

Regards

Alejandro

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2017
Added on Jan 27 2017
3 comments
550 views