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.Attributes; 20 import io.grpc.Metadata; 21 22 /** 23 * A observer of a server-side transport for stream creation events. Notifications must occur from 24 * the transport thread. 25 */ 26 public interface ServerTransportListener { 27 /** 28 * Called when a new stream was created by the remote client. 29 * 30 * @param stream the newly created stream. 31 * @param method the fully qualified method name being called on the server. 32 * @param headers containing metadata for the call. 33 */ streamCreated(ServerStream stream, String method, Metadata headers)34 void streamCreated(ServerStream stream, String method, Metadata headers); 35 36 /** 37 * The transport has finished all handshakes and is ready to process streams. 38 * 39 * @param attributes transport attributes 40 * 41 * @return the effective transport attributes that is used as the basis of call attributes 42 */ transportReady(Attributes attributes)43 Attributes transportReady(Attributes attributes); 44 45 /** 46 * The transport completed shutting down. All resources have been released. 47 */ transportTerminated()48 void transportTerminated(); 49 } 50