public static interface NettyConnection.RequestNSupplier
nfor calls to
PublisherSource.Subscription. A new
NettyConnection.RequestNSupplieris created for each
Publisherthat is written. Any method of an instance of
NettyConnection.RequestNSupplierwill never be called concurrently with the same or other methods of the same instance. This means that implementations do not have to worry about thread-safety.
|Modifier and Type||Method and Description|
Returns a new instance of a default implementation of
Callback whenever an item is written on the connection.
Given the current capacity of the write buffer, supply how many items to request next from the associated
void onItemWrite(java.lang.Object written, long writeBufferCapacityBeforeWrite, long writeBufferCapacityAfterWrite)
Write buffer capacity may not correctly reflect size of the object written. Hence capacity before may not necessarily be more than capacity after write.
written- Item that was written.
writeBufferCapacityBeforeWrite- Capacity of the write buffer before this item was written.
writeBufferCapacityAfterWrite- Capacity of the write buffer after this item was written.
long requestNFor(long writeBufferCapacityInBytes)
This method is invoked every time there could be a need to request more items from the write
This means that the supplied
writeBufferCapacityInBytes may include the capacity for which we have
already requested the write
Publisher. For suppliers that must only request more when there is an
increase in capacity, use
writeBufferCapacityInBytes- Current write buffer capacity. This will always be non-negative and will be 0 if buffer is full.
PublisherSource.Subscription. Implementation may assume that whatever is retuned here is sent as-is to the associated
static NettyConnection.RequestNSupplier newDefaultSupplier()