Package hudson.util

Class FileChannelWriter

  • All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable, Channel

    @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
    public class FileChannelWriter
    extends Writer
    implements Channel
    This class has been created to help make AtomicFileWriter hopefully more reliable in some corner cases. We created this wrapper to be able to access FileChannel.force(boolean) which seems to be one of the rare ways to actually have a guarantee that data be flushed to the physical device (only guaranteed for local, not for remote obviously though).

    The goal using this is to reduce as much as we can the likeliness to see zero-length files be created in place of the original ones.

    See Also:
    JENKINS-34855, PR-2548