Skip to content

Commit 9be6b1c

Browse files
committed
HTTPCLIENT-2334: AsyncDataProducer javadoc improvements
1 parent e009a92 commit 9be6b1c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncDataProducer.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,32 @@ public interface AsyncDataProducer extends ResourceHolder {
3939
* Returns the number of bytes immediately available for output.
4040
* This method can be used as a hint to control output events
4141
* of the underlying I/O session.
42+
* <p>
43+
* Please note this method should return zero if the data producer
44+
* is unable to produce any more data, in which case
45+
* {@link #produce(DataStreamChannel)} method will not get triggered.
46+
* The producer can resume writing out data asynchronously
47+
* once more data becomes available or request output readiness events
48+
* with {@link DataStreamChannel#requestOutput()}.
4249
*
4350
* @return the number of bytes immediately available for output
51+
*
52+
* @see #produce(DataStreamChannel)
53+
* @see DataStreamChannel#requestOutput()
4454
*/
4555
int available();
4656

4757
/**
4858
* Triggered to signal the ability of the underlying data channel
4959
* to accept more data. The data producer can choose to write data
5060
* immediately inside the call or asynchronously at some later point.
61+
* <p>
62+
* Please note this method gets triggered only if {@link #available()}
63+
* returns a positive value.
64+
*
65+
* @param channel the data channel capable of accepting more data.
5166
*
52-
* @param channel the data channel capable to accepting more data.
67+
* @see #available()
5368
*/
5469
void produce(DataStreamChannel channel) throws IOException;
5570

0 commit comments

Comments
 (0)