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