Class DurableFiles
java.lang.Object
io.jenkins.plugins.batchcontrol.store.DurableFiles
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final class DurableFiles
extends Object
#34: the forced writes every store write goes through, as core's
AtomicFileWriter does
them. A file that replaces another is written and forced to disk before the atomic rename, and
its directory is forced after it, so a power loss leaves either the old or the new file, never a
zero-length one; an appended record is forced before the operation that wrote it reports success.
Forces go through FileChannel.force(boolean) (which the JDK reports as the
jdk.FileForce event), never FileDescriptor.sync().
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidforceDirectory(Path dir) Forces the directory entries ofdir(a rename into it, a file created in it) to disk.static voidwriteForced(Path tmp, byte[] bytes) Writesbytesto the (new, empty) temporary filetmpand forces them to disk; the caller then renames it onto its target and callsforceDirectory(java.nio.file.Path).
-
Method Details
-
writeForced
Writesbytesto the (new, empty) temporary filetmpand forces them to disk; the caller then renames it onto its target and callsforceDirectory(java.nio.file.Path).- Throws:
IOException
-
forceDirectory
Forces the directory entries ofdir(a rename into it, a file created in it) to disk. Windows cannot open a directory as a channel, so it is skipped there, as core'sAtomicFileWriterdoes; anywhere else a refusal is logged and does not fail the write, which has already taken effect.
-