public class DelegatingFlushStrategy extends java.lang.Object implements FlushStrategy
FlushStrategy
implementation that delegates all calls to another FlushStrategy
.FlushStrategy.FlushSender, FlushStrategy.WriteEventsListener
Constructor and Description |
---|
DelegatingFlushStrategy(FlushStrategy delegate)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
FlushStrategy.WriteEventsListener |
apply(FlushStrategy.FlushSender sender)
Every time a new write that requires custom flushes is initiated, this method is invoked.
|
protected FlushStrategy |
delegate()
Returns the delegate
FlushStrategy used. |
boolean |
shouldFlushOnUnwritable()
Returns
true if pending writes, if any, MUST be flushed when the connection is not writable. |
public DelegatingFlushStrategy(FlushStrategy delegate)
delegate
- FlushStrategy
to delegate all calls.public FlushStrategy.WriteEventsListener apply(FlushStrategy.FlushSender sender)
FlushStrategy
FlushStrategy.FlushSender
is used to signal
to the connection that writes should now be
flushed.apply
in interface FlushStrategy
sender
- FlushStrategy.FlushSender
to signal flushes to the connection.FlushStrategy.WriteEventsListener
that would listen to write events on the connection for which custom flushes
are required.public boolean shouldFlushOnUnwritable()
FlushStrategy
true
if pending writes, if any, MUST be flushed when the connection is not writable. This method is expected to be idempotent.
shouldFlushOnUnwritable
in interface FlushStrategy
true
if pending writes, if any, MUST be flushed when the connection is not writable.protected FlushStrategy delegate()
FlushStrategy
used.FlushStrategy
used.