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 FlushStrategy
A strategy that defines how to flush writes on a connection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
FlushStrategy.FlushSender
An abstraction for aFlushStrategy
to flush writes by callingFlushStrategy.FlushSender.flush()
.static interface
FlushStrategy.WriteEventsListener
A listener of write events from the connection on which the relatedFlushStrategy
isapplied
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description FlushStrategy.WriteEventsListener
apply(FlushStrategy.FlushSender sender)
Every time a new write that requires custom flushes is initiated, this method is invoked.default boolean
shouldFlushOnUnwritable()
Returnstrue
if 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.FlushSender
is used tosignal
to the connection that writes should now be flushed.- Parameters:
sender
-FlushStrategy.FlushSender
to signal flushes to the connection.- Returns:
FlushStrategy.WriteEventsListener
that would listen to write events on the connection for which custom flushes are required.
-
shouldFlushOnUnwritable
default boolean shouldFlushOnUnwritable()
Returnstrue
if pending writes, if any, MUST be flushed when the connection is not writable.This method is expected to be idempotent.
- Returns:
true
if pending writes, if any, MUST be flushed when the connection is not writable.
-
-