Interface FlushStrategy
public interface FlushStrategy
Allows to configure a strategy for when flushes should be happening.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FlushStrategyDefaultFlushStrategyimplementation. -
Method Summary
Modifier and TypeMethodDescriptionstatic FlushStrategyafterNumBytes(int bytes) Implementation that flushes after a number of bytes.static FlushStrategyafterNumPackets(int packets) Implementation that flushes after a number of packets.booleanshouldFlushNow(int numPackets, int numBytes) Returnstrueif a flush should happen now,falseotherwise.
-
Field Details
-
DEFAULT
DefaultFlushStrategyimplementation.
-
-
Method Details
-
shouldFlushNow
boolean shouldFlushNow(int numPackets, int numBytes) Returnstrueif a flush should happen now,falseotherwise.- Parameters:
numPackets- the number of packets that were written since the last flush.numBytes- the number of bytes that were written since the last flush.- Returns:
trueif a flush should be done now,falseotherwise.
-
afterNumBytes
Implementation that flushes after a number of bytes.- Parameters:
bytes- the number of bytes after which we should issue a flush.- Returns:
- the
FlushStrategy.
-
afterNumPackets
Implementation that flushes after a number of packets.- Parameters:
packets- the number of packets after which we should issue a flush.- Returns:
- the
FlushStrategy.
-