Class FileSizeRotationPolicy

  • All Implemented Interfaces:
    Serializable, FileRotationPolicy

    public class FileSizeRotationPolicy
    extends Object
    implements FileRotationPolicy
    File rotation policy that will rotate files when a certain file size is reached.

    For example:

         // rotate when files reach 5MB
         FileSizeRotationPolicy policy =
              new FileSizeRotationPolicy(5.0, Units.MB);
     
    See Also:
    Serialized Form
    • Method Detail

      • mark

        public boolean mark​(TridentTuple tuple,
                            long offset)
        Description copied from interface: FileRotationPolicy
        Called for every tuple the HdfsBolt executes.
        Specified by:
        mark in interface FileRotationPolicy
        Parameters:
        tuple - The tuple executed.
        offset - current offset of file being written
        Returns:
        true if a file rotation should be performed
      • mark

        public boolean mark​(long offset)
        Description copied from interface: FileRotationPolicy
        Check if a file rotation should be performed based on the offset at which file is being written.
        Specified by:
        mark in interface FileRotationPolicy
        Parameters:
        offset - the current offset of file being written
        Returns:
        true if a file rotation should be performed.
      • start

        public void start()
        Description copied from interface: FileRotationPolicy
        Start the policy. Useful in case of policies like timed rotation where the timer can be started.
        Specified by:
        start in interface FileRotationPolicy
      • getMaxBytes

        public long getMaxBytes()