src/java.net.http/share/classes/java/net/http/WebSocket.java
branchhttp-client-branch
changeset 56678 136fe961f3eb
parent 56665 67fb9313d860
child 56679 cf6abca7ae7a
equal deleted inserted replaced
56665:67fb9313d860 56678:136fe961f3eb
    57  * {@code onPing}, {@code onPong} and {@code onClose} methods of
    57  * {@code onPing}, {@code onPong} and {@code onClose} methods of
    58  * {@code Listener}. WebSocket initiates a receive operation by invoking a
    58  * {@code Listener}. WebSocket initiates a receive operation by invoking a
    59  * receive method on the listener. The listener then must return a
    59  * receive method on the listener. The listener then must return a
    60  * {@code CompletionStage} which completes once the operation has completed.
    60  * {@code CompletionStage} which completes once the operation has completed.
    61  *
    61  *
    62  * <p> A WebSocket maintains an <a id="counter">internal counter</a>.
    62  * <p> To control message receiving, a WebSocket maintains an
    63  * This counter's value is a number of times the WebSocket has yet to invoke a
    63  * <a id="counter">internal counter</a>. This counter's value is a number of
    64  * receive method. While this counter is zero the WebSocket does not invoke
    64  * times the WebSocket has yet to invoke a receive method. While this counter is
    65  * receive methods. The counter is incremented by {@code n} when {@code
    65  * zero the WebSocket does not invoke receive methods. The counter is
    66  * request(n)} is called. The counter is decremented by one when the WebSocket
    66  * incremented by {@code n} when {@code request(n)} is called. The counter is
    67  * invokes a receive method. {@code onOpen} and {@code onError} are not receive
    67  * decremented by one when the WebSocket invokes a receive method.
    68  * methods. WebSocket invokes {@code onOpen} prior to any other methods on the
    68  * {@code onOpen} and {@code onError} are not receive methods. WebSocket invokes
    69  * listener. WebSocket invokes {@code onOpen} at most once. WebSocket may invoke
    69  * {@code onOpen} prior to any other methods on the listener. WebSocket invokes
    70  * {@code onError} at any given time. If the WebSocket invokes {@code onError}
    70  * {@code onOpen} at most once. WebSocket may invoke {@code onError} at any
    71  * or {@code onClose}, then no further listener's methods will be invoked, no
    71  * given time. If the WebSocket invokes {@code onError} or {@code onClose}, then
    72  * matter the value of the counter. For a newly built WebSocket the counter is
    72  * no further listener's methods will be invoked, no matter the value of the
    73  * zero. A WebSocket invokes methods on the listener in a thread-safe manner.
    73  * counter. For a newly built WebSocket the counter is zero. A WebSocket invokes
       
    74  * methods on the listener in a thread-safe manner.
    74  *
    75  *
    75  * <p> Unless otherwise stated, {@code null} arguments will cause methods
    76  * <p> Unless otherwise stated, {@code null} arguments will cause methods
    76  * of {@code WebSocket} to throw {@code NullPointerException}, similarly,
    77  * of {@code WebSocket} to throw {@code NullPointerException}, similarly,
    77  * {@code WebSocket} will not pass {@code null} arguments to methods of
    78  * {@code WebSocket} will not pass {@code null} arguments to methods of
    78  * {@code Listener}. The state of a WebSocket is not changed by the invocations
    79  * {@code Listener}. The state of a WebSocket is not changed by the invocations