Class BinManager
java.lang.Object
org.apache.nifi.processor.util.bin.BinManager
This class is thread safe
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final AtomicReference<String> private final AtomicIntegerprivate final AtomicIntegerprivate final AtomicLongprivate final AtomicIntegerprivate final AtomicLongprivate final Lockprivate final ReentrantReadWriteLockprivate final Lock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintoffer(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.booleanoffer(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.voidpurge()removeReadyBins(boolean relaxFullnessConstraint) Finds all bins that are considered full and removes them from the manager.voidsetFileCountAttribute(String fileCountAttribute) voidsetMaxBinAge(int seconds) voidsetMaximumEntries(int maximumEntries) voidsetMaximumSize(long numBytes) voidsetMinimumEntries(int minimumEntries) voidsetMinimumSize(long numBytes)
-
Field Details
-
minSizeBytes
-
maxSizeBytes
-
minEntries
-
maxEntries
-
fileCountAttribute
-
maxBinAgeSeconds
-
groupBinMap
-
rwLock
-
rLock
-
wLock
-
binCount
private int binCount
-
-
Constructor Details
-
BinManager
public BinManager()
-
-
Method Details
-
purge
public void purge() -
setFileCountAttribute
-
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 nullflowFile- the flow file to binsession- the ProcessSession to which the FlowFile belongssessionFactory- 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 nullflowFiles- the flow files to binsession- the ProcessSession to which the FlowFiles belongsessionFactory- 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
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
-
containsOldBins
public boolean containsOldBins()- Returns:
- true if any current bins are older than the allowable max
-