Class Bin
java.lang.Object
org.apache.nifi.processor.util.bin.Bin
Note:
Bin objects are NOT thread safe. If multiple threads access a Bin, the caller must synchronize
access.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate EvictionReasonprivate final Stringstatic final Stringprivate static final Patternprivate static final org.slf4j.Loggerprivate intprivate final longprivate intprivate final longprivate final ProcessSessionprivate longprivate int -
Constructor Summary
ConstructorsConstructorDescriptionBin(ProcessSession session, long minSizeBytes, long maxSizeBytes, int minEntries, int maxEntries, String fileCountAttribute) Constructs a new bin -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanisFull()Indicates whether the bin has enough items to be considered full.booleanIndicates enough size exists to meet the minimum requirementsbooleanisOlderThan(int duration, TimeUnit unit) Determines if this bin is older than the time specified.booleanisOlderThan(Bin other) Determines if this bin is older than the specified binbooleanoffer(FlowFile flowFile, ProcessSession session) If this bin has enough room for the size of the given flow file then it is added otherwise it is notvoidsetEvictionReason(EvictionReason evictionReason)
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
FRAGMENT_INDEX_ATTRIBUTE
-
session
-
creationMomentEpochNs
private final long creationMomentEpochNs -
minimumSizeBytes
private final long minimumSizeBytes -
maximumSizeBytes
private final long maximumSizeBytes -
minimumEntries
private volatile int minimumEntries -
maximumEntries
private volatile int maximumEntries -
fileCountAttribute
-
evictionReason
-
binContents
-
binIndexSet
-
size
private long size -
successiveFailedOfferings
private int successiveFailedOfferings -
intPattern
-
-
Constructor Details
-
Bin
public Bin(ProcessSession session, long minSizeBytes, long maxSizeBytes, int minEntries, int maxEntries, String fileCountAttribute) Constructs a new bin- Parameters:
session- the sessionminSizeBytes- min bytesmaxSizeBytes- max bytesminEntries- min entriesmaxEntries- max entriesfileCountAttribute- num files- Throws:
IllegalArgumentException- if the min is not less than or equal to the max.
-
-
Method Details
-
getSession
-
isFull
public boolean isFull()Indicates whether the bin has enough items to be considered full. This is based on whether the current size of the bin is greater than the minimum size in bytes and based on having a number of successive unsuccessful attempts to add a new item (because it is so close to the max or the size of the objects being attempted do not favor tight packing)- Returns:
- true if considered full; false otherwise
-
determineFullness
-
isFullEnough
public boolean isFullEnough()Indicates enough size exists to meet the minimum requirements- Returns:
- true if full enough
-
isOlderThan
Determines if this bin is older than the time specified.- Parameters:
duration- durationunit- unit- Returns:
- true if this bin is older than the length of time given; false otherwise
-
isOlderThan
Determines if this bin is older than the specified bin- Parameters:
other- other bin- Returns:
- true if this is older than given bin
-
getEvictionReason
-
setEvictionReason
-
offer
If this bin has enough room for the size of the given flow file then it is added otherwise it is not- Parameters:
flowFile- flowfile to offersession- the ProcessSession to which the FlowFile belongs- Returns:
- true if added; false otherwise
-
toInteger
-
getContents
- Returns:
- the underlying list of flow files within this bin
-
getBinAge
public long getBinAge()
-