Class BinManager

java.lang.Object
org.apache.nifi.processor.util.bin.BinManager

public class BinManager extends Object
This class is thread safe
  • Field Details

  • Constructor Details

    • BinManager

      public BinManager()
  • Method Details

    • purge

      public void purge()
    • setFileCountAttribute

      public void setFileCountAttribute(String fileCountAttribute)
    • getFileCountAttribute

      public String getFileCountAttribute()
    • setMinimumEntries

      public void setMinimumEntries(int minimumEntries)
    • setMaximumEntries

      public void setMaximumEntries(int maximumEntries)
    • getBinCount

      public int getBinCount()
    • setMinimumSize

      public void setMinimumSize(long numBytes)
    • setMaximumSize

      public void setMaximumSize(long numBytes)
    • setMaxBinAge

      public void setMaxBinAge(int seconds)
    • offer

      public boolean offer(String groupIdentifier, FlowFile flowFile, ProcessSession session, ProcessSessionFactory sessionFactory)
      Adds the given flowFile to the first available bin in which it fits for the given group or creates a new bin in the specified group if necessary.

      Parameters:
      groupIdentifier - the group to which the flow file belongs; can be null
      flowFile - the flow file to bin
      session - the ProcessSession to which the FlowFile belongs
      sessionFactory - a ProcessSessionFactory that can be used to create a new ProcessSession in order to create a new bin if necessary
      Returns:
      true if added; false if no bin exists which can fit this item and no bin can be created based on current min/max criteria
    • offer

      public Set<FlowFile> offer(String groupIdentifier, Collection<FlowFile> flowFiles, ProcessSession session, ProcessSessionFactory sessionFactory)
      Adds the given flowFiles to the first available bin in which it fits for the given group or creates a new bin in the specified group if necessary.

      Parameters:
      groupIdentifier - the group to which the flow file belongs; can be null
      flowFiles - the flow files to bin
      session - the ProcessSession to which the FlowFiles belong
      sessionFactory - a ProcessSessionFactory that can be used to create a new ProcessSession in order to create a new bin if necessary
      Returns:
      all of the FlowFiles that could not be successfully binned
    • removeReadyBins

      public Collection<Bin> removeReadyBins(boolean relaxFullnessConstraint)
      Finds all bins that are considered full and removes them from the manager.

      Parameters:
      relaxFullnessConstraint - if false will require bins to be full before considered ready; if true bins only have to meet their minimum size criteria or be 'old' and then they'll be considered ready
      Returns:
      bins that are considered full
    • removeOldestBin

      public Bin removeOldestBin()
    • containsOldBins

      public boolean containsOldBins()
      Returns:
      true if any current bins are older than the allowable max