1 /* 2 * Copyright 2017 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; 18 19 import javax.annotation.concurrent.ThreadSafe; 20 21 /** 22 * {@link StreamTracer} for the client-side. 23 */ 24 @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861") 25 @ThreadSafe 26 public abstract class ClientStreamTracer extends StreamTracer { 27 /** 28 * Headers has been sent to the socket. 29 */ outboundHeaders()30 public void outboundHeaders() { 31 } 32 33 /** 34 * Headers has been received from the server. 35 */ inboundHeaders()36 public void inboundHeaders() { 37 } 38 39 /** 40 * Factory class for {@link ClientStreamTracer}. 41 */ 42 public abstract static class Factory { 43 /** 44 * Creates a {@link ClientStreamTracer} for a new client stream. 45 * 46 * @deprecated Override/call {@link #newClientStreamTracer(CallOptions, Metadata)} instead. 47 */ 48 @Deprecated newClientStreamTracer(Metadata headers)49 public ClientStreamTracer newClientStreamTracer(Metadata headers) { 50 throw new UnsupportedOperationException("This method will be deleted. Do not call."); 51 } 52 53 /** 54 * Creates a {@link ClientStreamTracer} for a new client stream. 55 * 56 * @param callOptions the effective CallOptions of the call 57 * @param headers the mutable headers of the stream. It can be safely mutated within this 58 * method. It should not be saved because it is not safe for read or write after the 59 * method returns. 60 */ 61 @SuppressWarnings("deprecation") newClientStreamTracer(CallOptions callOptions, Metadata headers)62 public ClientStreamTracer newClientStreamTracer(CallOptions callOptions, Metadata headers) { 63 return newClientStreamTracer(headers); 64 } 65 } 66 } 67