T
- stream tuple typepublic class FileWriterCycleConfig<T>
extends java.lang.Object
Cycling the active file closes it, gets it to its final pathname,
and induces the application of a retention policy
FileWriterRetentionConfig
.
Cycling the active file can be any combination of:
fileSize
bytes have been writtencntTuple
tuples writtentuplePredicate
returns trueperiodMsec
has elapsed since the last time based cycleModifier and Type | Method and Description |
---|---|
boolean |
evaluate(long fileSize,
int nTuples,
T tuple)
Evaluate if the specified values indicate that a cycling of
the active file should be performed.
|
int |
getCntTuples()
Get the tuple count configuration value.
|
long |
getFileSize()
Get the file size configuration value.
|
long |
getPeriodMsec()
Get the time period configuration value.
|
Predicate<T> |
getTuplePredicate()
Get the tuple predicate configuration value.
|
static <T> FileWriterCycleConfig<T> |
newConfig(long fileSize,
int cntTuples,
long periodMsec,
Predicate<T> tuplePredicate)
Create a new configuration.
|
static <T> FileWriterCycleConfig<T> |
newCountBasedConfig(int cntTuples)
same as
newConfig0, cntTuples, 0, null) |
static <T> FileWriterCycleConfig<T> |
newFileSizeBasedConfig(long fileSize)
same as
newConfig(fileSize, 0, 0, null) |
static <T> FileWriterCycleConfig<T> |
newPredicateBasedConfig(Predicate<T> tuplePredicate)
same as
newConfig(0, 0, 0, tuplePredicate) |
static <T> FileWriterCycleConfig<T> |
newTimeBasedConfig(long periodMsec)
same as
newConfig(0, 0, periodMsec, null) |
java.lang.String |
toString() |
public static <T> FileWriterCycleConfig<T> newFileSizeBasedConfig(long fileSize)
newConfig(fileSize, 0, 0, null)
public static <T> FileWriterCycleConfig<T> newCountBasedConfig(int cntTuples)
newConfig0, cntTuples, 0, null)
public static <T> FileWriterCycleConfig<T> newTimeBasedConfig(long periodMsec)
newConfig(0, 0, periodMsec, null)
public static <T> FileWriterCycleConfig<T> newPredicateBasedConfig(Predicate<T> tuplePredicate)
newConfig(0, 0, 0, tuplePredicate)
public static <T> FileWriterCycleConfig<T> newConfig(long fileSize, int cntTuples, long periodMsec, Predicate<T> tuplePredicate)
At least one configuration mode must be enabled.
fileSize
- cycle after fileSize
bytes have been written. 0 to disable.cntTuples
- cycle after every cntTuple
tuples have been written. 0 to disable.periodMsec
- cycle after periodMsec
has elapsed since the last time based cycle. 0 to disable.tuplePredicate
- cycle if tuplePredicate
returns true. null to disable.public long getFileSize()
public int getCntTuples()
public long getPeriodMsec()
public Predicate<T> getTuplePredicate()
public boolean evaluate(long fileSize, int nTuples, T tuple)
fileSize
- the number of bytes written to the active filenTuples
- number of tuples written to the active filetuple
- the tuple written to the filepublic java.lang.String toString()
toString
in class java.lang.Object
Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902