Class FlushStrategies
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.FlushStrategies
-
public final class FlushStrategies extends java.lang.ObjectA factory for creatingFlushStrategy.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FlushStrategybatchFlush(int batchSize, Publisher<?> durationBoundaries)Creates aFlushStrategythat willflush writesin a batch ofbatchSizeor on expiration of a batch duration i.e.static FlushStrategydefaultFlushStrategy()Creates a defaultFlushStrategy.static FlushStrategyflushOnEach()Creates aFlushStrategythat willflush writeson each call to the returnedFlushStrategy.WriteEventsListener.itemWritten(Object)fromFlushStrategy.apply(FlushSender).static FlushStrategyflushOnEnd()Creates aFlushStrategythat willflush writeswhenFlushStrategy.WriteEventsListener.writeTerminated()is called on theFlushStrategy.WriteEventsListenerreturned fromFlushStrategy.apply(FlushSender).static FlushStrategyflushWith(Publisher<?> flushBoundaries)
-
-
-
Method Detail
-
defaultFlushStrategy
public static FlushStrategy defaultFlushStrategy()
Creates a defaultFlushStrategy.- Returns:
- Default
FlushStrategy.
-
flushOnEach
public static FlushStrategy flushOnEach()
Creates aFlushStrategythat willflush writeson each call to the returnedFlushStrategy.WriteEventsListener.itemWritten(Object)fromFlushStrategy.apply(FlushSender).- Returns:
- A
FlushStrategythat willflush writeson each call to the returnedFlushStrategy.WriteEventsListener.itemWritten(Object)fromFlushStrategy.apply(FlushSender).
-
batchFlush
public static FlushStrategy batchFlush(int batchSize, Publisher<?> durationBoundaries)
Creates aFlushStrategythat willflush writesin a batch ofbatchSizeor on expiration of a batch duration i.e. when an item is emitted fromdurationBoundaries.- Parameters:
batchSize- Number of items in each batch which needs flushing.durationBoundaries- Batch durations. Every time an item is emitted on thisPublisher, the returnedFlushStrategywillflush writes.- Returns:
- A
FlushStrategythat willflush writesin a batch ofbatchSizeor on expiration of a batch duration i.e. when an item is emitted fromdurationBoundaries.
-
flushWith
public static FlushStrategy flushWith(Publisher<?> flushBoundaries)
- Parameters:
flushBoundaries- Flush boundaries. Every time an item is emitted on thisPublisher, the returnedFlushStrategywillflush writes.- Returns:
- A
FlushStrategythat willflush writeswhen an item is emitted fromflushBoundaries.
-
flushOnEnd
public static FlushStrategy flushOnEnd()
Creates aFlushStrategythat willflush writeswhenFlushStrategy.WriteEventsListener.writeTerminated()is called on theFlushStrategy.WriteEventsListenerreturned fromFlushStrategy.apply(FlushSender).- Returns:
- A
FlushStrategythat willflush writeswhen either ofFlushStrategy.WriteEventsListener.writeTerminated()is called on theFlushStrategy.WriteEventsListenerreturned fromFlushStrategy.apply(FlushSender).
-
-