Fix flow-control documentation on Stream

This commit is contained in:
Kun Zhang 2015-09-04 14:34:28 -07:00
parent 264dc09cfd
commit ae4ee40711
1 changed files with 7 additions and 9 deletions

View File

@ -56,12 +56,8 @@ public interface Stream {
* {@link io.grpc.KnownLength} to improve efficiency. This method will always return immediately * {@link io.grpc.KnownLength} to improve efficiency. This method will always return immediately
* and will not wait for the write to complete. * and will not wait for the write to complete.
* *
* <p> * <p>It is recommended that the caller consult {@link #isReady()} before calling this method to
* When the write is "accepted" by the transport, the given callback (if provided) will be called. * avoid excessive buffering in the transport.
* The definition of what it means to be "accepted" is up to the transport implementation, but
* this is a general indication that the transport is capable of handling more out-bound data on
* the stream. If the stream/connection is closed for any reason before the write could be
* accepted, the callback will never be invoked.
* *
* @param message stream containing the serialized message to be sent * @param message stream containing the serialized message to be sent
*/ */
@ -73,9 +69,11 @@ public interface Stream {
void flush(); void flush();
/** /**
* If {@code true}, indicates that the transport is capable of sending additional messages * If {@code true}, indicates that the transport is capable of sending additional messages without
* without requiring excessive buffering internally. This event is * requiring excessive buffering internally. Otherwise, {@link StreamListener#onReady()} will be
* just a suggestion and the application is free to ignore it, however doing so may * called when it turns {@code true}.
*
* <p>This is just a suggestion and the application is free to ignore it, however doing so may
* result in excessive buffering within the transport. * result in excessive buffering within the transport.
*/ */
boolean isReady(); boolean isReady();