Class RecordBinManager
java.lang.Object
org.apache.nifi.processors.standard.merge.RecordBinManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicIntegerprivate final org.apache.nifi.processor.ProcessContextprivate final Lockprivate final org.apache.nifi.logging.ComponentLogprivate final AtomicLongprivate final intprivate final org.apache.nifi.processor.ProcessSessionFactory -
Constructor Summary
ConstructorsConstructorDescriptionRecordBinManager(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory, org.apache.nifi.logging.ComponentLog logger) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String groupIdentifier, org.apache.nifi.flowfile.FlowFile flowFile, RecordReader reader, org.apache.nifi.processor.ProcessSession session, boolean block) 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.intintintvoidprivate RecordBinThresholdscreateThresholds(org.apache.nifi.flowfile.FlowFile flowfile) intprivate inthandleCompletedBins(Predicate<RecordBin> completionTest, String completionReason) voidpurge()Must be called only when there are no active threads modifying the bins.private voidremoveBins(String key, List<RecordBin> bins) voidsetMaxBinAge(Long timePeriod, TimeUnit timeUnit)
-
Field Details
-
context
private final org.apache.nifi.processor.ProcessContext context -
sessionFactory
private final org.apache.nifi.processor.ProcessSessionFactory sessionFactory -
logger
private final org.apache.nifi.logging.ComponentLog logger -
maxBinCount
private final int maxBinCount -
maxBinAgeNanos
-
groupBinMap
-
lock
-
binCount
-
-
Constructor Details
-
RecordBinManager
public RecordBinManager(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory, org.apache.nifi.logging.ComponentLog logger)
-
-
Method Details
-
purge
public void purge()Must be called only when there are no active threads modifying the bins. -
setMaxBinAge
-
getBinCount
public int getBinCount() -
add
public void add(String groupIdentifier, org.apache.nifi.flowfile.FlowFile flowFile, RecordReader reader, org.apache.nifi.processor.ProcessSession session, boolean block) throws IOException 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 nullflowFile- flowFile to binreader- RecordReader to use for reading FlowFilesession- the ProcessSession to which the FlowFiles belongblock- if another thread is already writing to the desired bin, passingtruefor this parameter will block until the other thread(s) have finished so that the records can still be added to the desired bin. Passingfalsewill result in moving on to another bin.- Throws:
IOException- if there is an IO problem reading from the stream or writing to the stream
-
createThresholds
-
completeOldestBin
- Throws:
IOException
-
completeExpiredBins
- Throws:
IOException
-
completeFullEnoughBins
- Throws:
IOException
-
completeFullBins
- Throws:
IOException
-
handleCompletedBins
private int handleCompletedBins(Predicate<RecordBin> completionTest, String completionReason) throws IOException - Throws:
IOException
-
removeBins
-