Interface FlushStrategy.WriteEventsListener
-
- All Known Implementing Classes:
NoopWriteEventsListener
- Enclosing interface:
- FlushStrategy
public static interface FlushStrategy.WriteEventsListener
A listener of write events from the connection on which the relatedFlushStrategy
isapplied
. For eachFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, following calls will be made:- At most one call to
writeStarted()
- Zero or more calls to
itemWritten(Object)
- At most one call to
writeTerminated()
- At most one call to
writeCancelled()
- At least one call to either
writeTerminated()
orwriteCancelled()
writeStarted()
always happens-before a call to any other methods.None of
writeStarted()
,itemWritten(Object)
andwriteTerminated()
can be called concurrently with each other butwriteCancelled()
can be called concurrently withitemWritten(Object)
orwriteTerminated()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
itemWritten(java.lang.Object written)
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called once after any item is written to the connection.void
writeCancelled()
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once when writes are cancelled.void
writeStarted()
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once before any items are written to the connection.void
writeTerminated()
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once when all other items are written to the connection.
-
-
-
Method Detail
-
writeStarted
void writeStarted()
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once before any items are written to the connection.This will be followed by zero or more calls to
itemWritten(Object)
and at most one call towriteTerminated()
andwriteCancelled()
or both.
-
itemWritten
void itemWritten(@Nullable java.lang.Object written)
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called once after any item is written to the connection.This will be followed by zero or more calls to this method and at most one call to
writeTerminated()
andwriteCancelled()
or both.writeCancelled()
can be called concurrently with this method.- Parameters:
written
- Item that was written.
-
writeTerminated
void writeTerminated()
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once when all other items are written to the connection.writeCancelled()
MAY be called concurrently or after this method.
-
writeCancelled
void writeCancelled()
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once when writes are cancelled.itemWritten(Object)
orwriteTerminated()
MAY be called concurrently or after this method.
-
-