Interface RotatableObject

  • All Known Implementing Classes:
    RotatableWriter

    public interface RotatableObject
    Interface defining methods a rotatable file needs.
    • Method Detail

      • getBytesWritten

        long getBytesWritten()
        Retrieves the number of bytes written to the file.
        Returns:
        The number of bytes written to the file.
      • getLastRotationTime

        OffsetDateTime getLastRotationTime()
        Retrieves the last time the file was rotated. If a file rotation never occurred, this value will be the time the server started.
        Returns:
        The last time file rotation occurred.
      • rotateIfNeeded

        boolean rotateIfNeeded()
                        throws IOException
        Checks the rotatable file for rotation then retention. The file is rotated if the configured RotationPolicy's are true. The old audit files are retained/deleted according to the RetentionPolicy's configured.
        Returns:
        true if rotation took place.
        Throws:
        IOException - If unable to rotateIfNeeded the audit file.
      • close

        void close()
            throws IOException
        Closes the rotatable file.
        Throws:
        IOException - If an exception occurs while closing.
      • registerRotationHooks

        void registerRotationHooks​(RotationHooks rotationHooks)
        Registers hooks into the rotation process.
        Parameters:
        rotationHooks - The RotationHooks into the rotation process.