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 related
FlushStrategy
is
applied
.
For each FlushStrategy.WriteEventsListener
returned from FlushStrategy.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)
and writeTerminated()
can be called
concurrently with each other but writeCancelled()
can be called concurrently with
itemWritten(Object)
or writeTerminated()
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
itemWritten
(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
For each newFlushStrategy.WriteEventsListener
returned fromFlushStrategy.apply(FlushSender)
, this method will be called at most once when writes are cancelled.void
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
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 Details
-
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
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.
-