1 /* 2 * Copyright 2014 The gRPC Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.grpc.internal; 18 19 import io.grpc.Status; 20 21 /** An observer of server-side stream events. */ 22 public interface ServerStreamListener extends StreamListener { 23 /** 24 * Called when the remote side of the transport gracefully closed, indicating the client had no 25 * more data to send. No further messages will be received on the stream. 26 * 27 * <p>This method should return quickly, as the same thread may be used to process other streams. 28 */ halfClosed()29 void halfClosed(); 30 31 /** 32 * Called when the stream is fully closed. A status code of {@link 33 * io.grpc.Status.Code#OK} implies normal termination of the stream. 34 * Any other value implies abnormal termination. Since clients cannot send status, the passed 35 * status is always library-generated and only is concerned with transport-level stream shutdown 36 * (the call itself may have had a failing status, but if the stream terminated cleanly with the 37 * status appearing to have been sent, then the passed status here would be {@code OK}). This is 38 * guaranteed to always be the final call on a listener. No further callbacks will be issued. 39 * 40 * <p>This method should return quickly, as the same thread may be used to process other streams. 41 * 42 * @param status details about the remote closure 43 */ closed(Status status)44 void closed(Status status); 45 } 46