1 /* 2 * Copyright 2016 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 com.google.common.base.MoreObjects; 20 import com.google.common.util.concurrent.ListenableFuture; 21 import io.grpc.Attributes; 22 import io.grpc.CallOptions; 23 import io.grpc.InternalChannelz.SocketStats; 24 import io.grpc.InternalLogId; 25 import io.grpc.Metadata; 26 import io.grpc.MethodDescriptor; 27 import io.grpc.Status; 28 import java.util.concurrent.Executor; 29 30 abstract class ForwardingConnectionClientTransport implements ConnectionClientTransport { 31 @Override start(Listener listener)32 public Runnable start(Listener listener) { 33 return delegate().start(listener); 34 } 35 36 @Override shutdown(Status status)37 public void shutdown(Status status) { 38 delegate().shutdown(status); 39 } 40 41 @Override shutdownNow(Status status)42 public void shutdownNow(Status status) { 43 delegate().shutdownNow(status); 44 } 45 46 @Override newStream( MethodDescriptor<?, ?> method, Metadata headers, CallOptions callOptions)47 public ClientStream newStream( 48 MethodDescriptor<?, ?> method, Metadata headers, CallOptions callOptions) { 49 return delegate().newStream(method, headers, callOptions); 50 } 51 52 @Override ping(PingCallback callback, Executor executor)53 public void ping(PingCallback callback, Executor executor) { 54 delegate().ping(callback, executor); 55 } 56 57 @Override getLogId()58 public InternalLogId getLogId() { 59 return delegate().getLogId(); 60 } 61 62 @Override getAttributes()63 public Attributes getAttributes() { 64 return delegate().getAttributes(); 65 } 66 67 @Override toString()68 public String toString() { 69 return MoreObjects.toStringHelper(this).add("delegate", delegate()).toString(); 70 } 71 72 @Override getStats()73 public ListenableFuture<SocketStats> getStats() { 74 return delegate().getStats(); 75 } 76 delegate()77 protected abstract ConnectionClientTransport delegate(); 78 } 79