public static void atomicMoveWithFallback ( Path source , Path target , Object requester ) throws IOException { try { Files . move ( source , target , StandardCopyOption . ATOMIC_MOVE ) ; } catch ( AtomicMoveNotSupportedException ignore ) { OLogManager . instance ( ) . warn ( requester , "atomic file move is not possible, falling back to regular move (moving '%s' to '%s')" , source , target ) ; Files . move ( source , target ) ; } }
Tries to move a file from the source to the target atomically . If atomic move is not possible falls back to regular move .