use of java.nio.file.AtomicMoveNotSupportedException in project atomix by atomix.
the class FileSnapshot method persistTemporaryFile.
private void persistTemporaryFile() throws IOException {
final Path temporaryPath = file.temporaryFile().toPath();
final Path persistedPath = file.file().toPath();
try {
Files.move(temporaryPath, persistedPath, StandardCopyOption.ATOMIC_MOVE);
} catch (AtomicMoveNotSupportedException e) {
try {
Files.move(temporaryPath, persistedPath);
} catch (FileAlreadyExistsException ignored) {
LOGGER.debug("Snapshot {} was already previously completed", this);
}
}
}
use of java.nio.file.AtomicMoveNotSupportedException in project graal by oracle.
the class IOHelper method move.
static void move(final Path source, final Path target, final FileSystem fileSystem, CopyOption... options) throws IOException {
for (CopyOption option : options) {
if (StandardCopyOption.ATOMIC_MOVE.equals(option)) {
throw new AtomicMoveNotSupportedException(source.toString(), target.toString(), "Atomic move not supported");
}
}
fileSystem.copy(source, target, options);
fileSystem.delete(source);
}
Aggregations