Skip to content

Commit

Permalink
HTTPCLIENT-2334: AsyncDataProducer javadoc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ok2c committed Aug 2, 2024
1 parent e009a92 commit 9be6b1c
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,32 @@ public interface AsyncDataProducer extends ResourceHolder {
* Returns the number of bytes immediately available for output.
* This method can be used as a hint to control output events
* of the underlying I/O session.
* <p>
* Please note this method should return zero if the data producer
* is unable to produce any more data, in which case
* {@link #produce(DataStreamChannel)} method will not get triggered.
* The producer can resume writing out data asynchronously
* once more data becomes available or request output readiness events
* with {@link DataStreamChannel#requestOutput()}.
*
* @return the number of bytes immediately available for output
*
* @see #produce(DataStreamChannel)
* @see DataStreamChannel#requestOutput()
*/
int available();

/**
* Triggered to signal the ability of the underlying data channel
* to accept more data. The data producer can choose to write data
* immediately inside the call or asynchronously at some later point.
* <p>
* Please note this method gets triggered only if {@link #available()}
* returns a positive value.
*
* @param channel the data channel capable of accepting more data.
*
* @param channel the data channel capable to accepting more data.
* @see #available()
*/
void produce(DataStreamChannel channel) throws IOException;

Expand Down

0 comments on commit 9be6b1c

Please sign in to comment.