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.

@FunctionalInterface public interface FlushStrategy
A strategy that defines how to flush writes on a connection.
  • Method Details

    • apply

      Every time a new write that requires custom flushes is initiated, this method is invoked. Passed FlushStrategy.FlushSender is used to signal 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()
      Returns true 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.