T
- stream tuple typepublic class FileWriterFlushConfig<T>
extends java.lang.Object
Flushing of the active file can be any combination of:
cntTuple
tuples writtentuplePredicate
returns trueperiodMsec
has elapsed since the last time based flushModifier and Type | Method and Description |
---|---|
boolean |
evaluate(int nTuples,
T tuple)
Evaluate if the specified values indicate that a flush should be
performed.
|
int |
getCntTuples()
Get the tuple count configuration value.
|
long |
getPeriodMsec()
Get the time period configuration value.
|
Predicate<T> |
getTuplePredicate()
Get the tuple predicate configuration value.
|
static <T> FileWriterFlushConfig<T> |
newConfig(int cntTuples,
long periodMsec,
Predicate<T> tuplePredicate)
Create a new configuration.
|
static <T> FileWriterFlushConfig<T> |
newCountBasedConfig(int cntTuples)
same as
newConfig(cntTuples, 0, null) |
static <T> FileWriterFlushConfig<T> |
newImplicitConfig()
Create a new configuration.
|
static <T> FileWriterFlushConfig<T> |
newPredicateBasedConfig(Predicate<T> tuplePredicate)
same as
newConfig(0, 0, tuplePredicate) |
static <T> FileWriterFlushConfig<T> |
newTimeBasedConfig(long periodMsec)
same as
newConfig(0, periodMsec, null) |
java.lang.String |
toString() |
public static <T> FileWriterFlushConfig<T> newImplicitConfig()
The underlying buffered writer's automatic flushing is used.
Same as newConfig(0, 0, null)
T
- Tuple typepublic static <T> FileWriterFlushConfig<T> newCountBasedConfig(int cntTuples)
newConfig(cntTuples, 0, null)
T
- Tuple typecntTuples
- flush every cntTuple
tuples written. 0 to disable.public static <T> FileWriterFlushConfig<T> newTimeBasedConfig(long periodMsec)
newConfig(0, periodMsec, null)
T
- Tuple typeperiodMsec
- flush every periodMsec
milliseconds. 0 to disable.public static <T> FileWriterFlushConfig<T> newPredicateBasedConfig(Predicate<T> tuplePredicate)
newConfig(0, 0, tuplePredicate)
T
- Tuple typetuplePredicate
- flush if tuplePredicate
is true. null to disable.public static <T> FileWriterFlushConfig<T> newConfig(int cntTuples, long periodMsec, Predicate<T> tuplePredicate)
If nothing specific is specified, the underlying buffered writer's automatic flushing is utilized.
T
- Tuple typecntTuples
- flush every cntTuple
tuples written. 0 to disable.periodMsec
- flush every periodMsec
milliseconds. 0 to disable.tuplePredicate
- flush if tuplePredicate
is true. null to disable.public int getCntTuples()
public long getPeriodMsec()
public Predicate<T> getTuplePredicate()
public boolean evaluate(int nTuples, T tuple)
nTuples
- 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 © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641