Interface FlushStrategy
-
- All Known Implementing Classes:
DelegatingFlushStrategy,MockFlushStrategy,SplittingFlushStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface FlushStrategyA strategy that defines how to flush writes on a connection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceFlushStrategy.FlushSenderAn abstraction for aFlushStrategyto flush writes by callingFlushStrategy.FlushSender.flush().static interfaceFlushStrategy.WriteEventsListenerA listener of write events from the connection on which the relatedFlushStrategyisapplied.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description FlushStrategy.WriteEventsListenerapply(FlushStrategy.FlushSender sender)Every time a new write that requires custom flushes is initiated, this method is invoked.default booleanshouldFlushOnUnwritable()Returnstrueif pending writes, if any, MUST be flushed when the connection is not writable.
-
-
-
Method Detail
-
apply
FlushStrategy.WriteEventsListener apply(FlushStrategy.FlushSender sender)
Every time a new write that requires custom flushes is initiated, this method is invoked. PassedFlushStrategy.FlushSenderis used tosignalto the connection that writes should now be flushed.- Parameters:
sender-FlushStrategy.FlushSenderto signal flushes to the connection.- Returns:
FlushStrategy.WriteEventsListenerthat would listen to write events on the connection for which custom flushes are required.
-
shouldFlushOnUnwritable
default boolean shouldFlushOnUnwritable()
Returnstrueif pending writes, if any, MUST be flushed when the connection is not writable.This method is expected to be idempotent.
- Returns:
trueif pending writes, if any, MUST be flushed when the connection is not writable.
-
-