Interface FlushStrategy
- All Known Implementing Classes:
DelegatingFlushStrategy
,SplittingFlushStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A strategy that defines how to flush writes on a connection.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
An abstraction for aFlushStrategy
to flush writes by callingFlushStrategy.FlushSender.flush()
.static interface
A listener of write events from the connection on which the relatedFlushStrategy
isapplied
. -
Method Summary
Modifier and TypeMethodDescriptionapply
(FlushStrategy.FlushSender sender) Every time a new write that requires custom flushes is initiated, this method is invoked.default boolean
Returnstrue
if pending writes, if any, MUST be flushed when the connection is not writable.
-
Method Details
-
apply
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.
-