Skip to content

Commit 23e6318

Browse files
committed
Reduce API surface of AbstractStub
1 parent ec965ca commit 23e6318

File tree

11 files changed

+60
-60
lines changed

11 files changed

+60
-60
lines changed

benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ protected TestServiceStub build(io.grpc.Channel channel,
9393
public void unaryCall(io.grpc.testing.SimpleRequest request,
9494
io.grpc.stub.StreamObserver<io.grpc.testing.SimpleResponse> responseObserver) {
9595
asyncUnaryCall(
96-
channel.newCall(METHOD_UNARY_CALL, callOptions), request, responseObserver);
96+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
9797
}
9898

9999
@java.lang.Override
100100
public io.grpc.stub.StreamObserver<io.grpc.testing.SimpleRequest> streamingCall(
101101
io.grpc.stub.StreamObserver<io.grpc.testing.SimpleResponse> responseObserver) {
102102
return asyncBidiStreamingCall(
103-
channel.newCall(METHOD_STREAMING_CALL, callOptions), responseObserver);
103+
getChannel().newCall(METHOD_STREAMING_CALL, getCallOptions()), responseObserver);
104104
}
105105
}
106106

@@ -124,7 +124,7 @@ protected TestServiceBlockingStub build(io.grpc.Channel channel,
124124
@java.lang.Override
125125
public io.grpc.testing.SimpleResponse unaryCall(io.grpc.testing.SimpleRequest request) {
126126
return blockingUnaryCall(
127-
channel.newCall(METHOD_UNARY_CALL, callOptions), request);
127+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
128128
}
129129
}
130130

@@ -149,7 +149,7 @@ protected TestServiceFutureStub build(io.grpc.Channel channel,
149149
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.SimpleResponse> unaryCall(
150150
io.grpc.testing.SimpleRequest request) {
151151
return futureUnaryCall(
152-
channel.newCall(METHOD_UNARY_CALL, callOptions), request);
152+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
153153
}
154154
}
155155

benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ protected WorkerStub build(io.grpc.Channel channel,
8888
public io.grpc.stub.StreamObserver<io.grpc.testing.ClientArgs> runTest(
8989
io.grpc.stub.StreamObserver<io.grpc.testing.ClientStatus> responseObserver) {
9090
return asyncBidiStreamingCall(
91-
channel.newCall(METHOD_RUN_TEST, callOptions), responseObserver);
91+
getChannel().newCall(METHOD_RUN_TEST, getCallOptions()), responseObserver);
9292
}
9393

9494
@java.lang.Override
9595
public io.grpc.stub.StreamObserver<io.grpc.testing.ServerArgs> runServer(
9696
io.grpc.stub.StreamObserver<io.grpc.testing.ServerStatus> responseObserver) {
9797
return asyncBidiStreamingCall(
98-
channel.newCall(METHOD_RUN_SERVER, callOptions), responseObserver);
98+
getChannel().newCall(METHOD_RUN_SERVER, getCallOptions()), responseObserver);
9999
}
100100
}
101101

compiler/src/java_plugin/cpp/java_generator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static void PrintStub(
359359
p->Print(
360360
*vars,
361361
"return $calls_method$(\n"
362-
" channel.newCall($method_field_name$, callOptions), $params$);\n");
362+
" getChannel().newCall($method_field_name$, getCallOptions()), $params$);\n");
363363
break;
364364
case ASYNC_CALL:
365365
if (server_streaming) {
@@ -383,7 +383,7 @@ static void PrintStub(
383383
p->Print(
384384
*vars,
385385
"$last_line_prefix$$calls_method$(\n"
386-
" channel.newCall($method_field_name$, callOptions), $params$);\n");
386+
" getChannel().newCall($method_field_name$, getCallOptions()), $params$);\n");
387387
break;
388388
case FUTURE_CALL:
389389
GRPC_CODEGEN_CHECK(!client_streaming && !server_streaming)
@@ -394,7 +394,7 @@ static void PrintStub(
394394
p->Print(
395395
*vars,
396396
"return $calls_method$(\n"
397-
" channel.newCall($method_field_name$, callOptions), request);\n");
397+
" getChannel().newCall($method_field_name$, getCallOptions()), request);\n");
398398
break;
399399
}
400400
p->Outdent();

compiler/src/test/golden/TestService.java.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,35 +132,35 @@ public class TestServiceGrpc {
132132
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
133133
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
134134
asyncUnaryCall(
135-
channel.newCall(METHOD_UNARY_CALL, callOptions), request, responseObserver);
135+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
136136
}
137137

138138
@java.lang.Override
139139
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
140140
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
141141
asyncServerStreamingCall(
142-
channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request, responseObserver);
142+
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
143143
}
144144

145145
@java.lang.Override
146146
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
147147
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
148148
return asyncClientStreamingCall(
149-
channel.newCall(METHOD_STREAMING_INPUT_CALL, callOptions), responseObserver);
149+
getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
150150
}
151151

152152
@java.lang.Override
153153
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
154154
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
155155
return asyncBidiStreamingCall(
156-
channel.newCall(METHOD_FULL_BIDI_CALL, callOptions), responseObserver);
156+
getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
157157
}
158158

159159
@java.lang.Override
160160
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
161161
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
162162
return asyncBidiStreamingCall(
163-
channel.newCall(METHOD_HALF_BIDI_CALL, callOptions), responseObserver);
163+
getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
164164
}
165165
}
166166

@@ -184,14 +184,14 @@ public class TestServiceGrpc {
184184
@java.lang.Override
185185
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
186186
return blockingUnaryCall(
187-
channel.newCall(METHOD_UNARY_CALL, callOptions), request);
187+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
188188
}
189189

190190
@java.lang.Override
191191
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
192192
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
193193
return blockingServerStreamingCall(
194-
channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request);
194+
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request);
195195
}
196196
}
197197

@@ -216,7 +216,7 @@ public class TestServiceGrpc {
216216
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
217217
io.grpc.testing.integration.Test.SimpleRequest request) {
218218
return futureUnaryCall(
219-
channel.newCall(METHOD_UNARY_CALL, callOptions), request);
219+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
220220
}
221221
}
222222

compiler/src/test/golden/TestServiceNano.java.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,35 +194,35 @@ public class TestServiceGrpc {
194194
public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
195195
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
196196
asyncUnaryCall(
197-
channel.newCall(METHOD_UNARY_CALL, callOptions), request, responseObserver);
197+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
198198
}
199199

200200
@java.lang.Override
201201
public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
202202
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
203203
asyncServerStreamingCall(
204-
channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request, responseObserver);
204+
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
205205
}
206206

207207
@java.lang.Override
208208
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
209209
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
210210
return asyncClientStreamingCall(
211-
channel.newCall(METHOD_STREAMING_INPUT_CALL, callOptions), responseObserver);
211+
getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
212212
}
213213

214214
@java.lang.Override
215215
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
216216
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
217217
return asyncBidiStreamingCall(
218-
channel.newCall(METHOD_FULL_BIDI_CALL, callOptions), responseObserver);
218+
getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
219219
}
220220

221221
@java.lang.Override
222222
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
223223
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
224224
return asyncBidiStreamingCall(
225-
channel.newCall(METHOD_HALF_BIDI_CALL, callOptions), responseObserver);
225+
getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
226226
}
227227
}
228228

@@ -246,14 +246,14 @@ public class TestServiceGrpc {
246246
@java.lang.Override
247247
public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
248248
return blockingUnaryCall(
249-
channel.newCall(METHOD_UNARY_CALL, callOptions), request);
249+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
250250
}
251251

252252
@java.lang.Override
253253
public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
254254
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
255255
return blockingServerStreamingCall(
256-
channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request);
256+
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request);
257257
}
258258
}
259259

@@ -278,7 +278,7 @@ public class TestServiceGrpc {
278278
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
279279
io.grpc.testing.integration.nano.Test.SimpleRequest request) {
280280
return futureUnaryCall(
281-
channel.newCall(METHOD_UNARY_CALL, callOptions), request);
281+
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
282282
}
283283
}
284284

examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected GreeterStub build(io.grpc.Channel channel,
8181
public void sayHello(io.grpc.examples.helloworld.HelloRequest request,
8282
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloResponse> responseObserver) {
8383
asyncUnaryCall(
84-
channel.newCall(METHOD_SAY_HELLO, callOptions), request, responseObserver);
84+
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request, responseObserver);
8585
}
8686
}
8787

@@ -105,7 +105,7 @@ protected GreeterBlockingStub build(io.grpc.Channel channel,
105105
@java.lang.Override
106106
public io.grpc.examples.helloworld.HelloResponse sayHello(io.grpc.examples.helloworld.HelloRequest request) {
107107
return blockingUnaryCall(
108-
channel.newCall(METHOD_SAY_HELLO, callOptions), request);
108+
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request);
109109
}
110110
}
111111

@@ -130,7 +130,7 @@ protected GreeterFutureStub build(io.grpc.Channel channel,
130130
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloResponse> sayHello(
131131
io.grpc.examples.helloworld.HelloRequest request) {
132132
return futureUnaryCall(
133-
channel.newCall(METHOD_SAY_HELLO, callOptions), request);
133+
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request);
134134
}
135135
}
136136

examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,28 @@ protected RouteGuideStub build(io.grpc.Channel channel,
120120
public void getFeature(io.grpc.examples.routeguide.Point request,
121121
io.grpc.stub.StreamObserver<io.grpc.examples.routeguide.Feature> responseObserver) {
122122
asyncUnaryCall(
123-
channel.newCall(METHOD_GET_FEATURE, callOptions), request, responseObserver);
123+
getChannel().newCall(METHOD_GET_FEATURE, getCallOptions()), request, responseObserver);
124124
}
125125

126126
@java.lang.Override
127127
public void listFeatures(io.grpc.examples.routeguide.Rectangle request,
128128
io.grpc.stub.StreamObserver<io.grpc.examples.routeguide.Feature> responseObserver) {
129129
asyncServerStreamingCall(
130-
channel.newCall(METHOD_LIST_FEATURES, callOptions), request, responseObserver);
130+
getChannel().newCall(METHOD_LIST_FEATURES, getCallOptions()), request, responseObserver);
131131
}
132132

133133
@java.lang.Override
134134
public io.grpc.stub.StreamObserver<io.grpc.examples.routeguide.Point> recordRoute(
135135
io.grpc.stub.StreamObserver<io.grpc.examples.routeguide.RouteSummary> responseObserver) {
136136
return asyncClientStreamingCall(
137-
channel.newCall(METHOD_RECORD_ROUTE, callOptions), responseObserver);
137+
getChannel().newCall(METHOD_RECORD_ROUTE, getCallOptions()), responseObserver);
138138
}
139139

140140
@java.lang.Override
141141
public io.grpc.stub.StreamObserver<io.grpc.examples.routeguide.RouteNote> routeChat(
142142
io.grpc.stub.StreamObserver<io.grpc.examples.routeguide.RouteNote> responseObserver) {
143143
return asyncBidiStreamingCall(
144-
channel.newCall(METHOD_ROUTE_CHAT, callOptions), responseObserver);
144+
getChannel().newCall(METHOD_ROUTE_CHAT, getCallOptions()), responseObserver);
145145
}
146146
}
147147

@@ -165,14 +165,14 @@ protected RouteGuideBlockingStub build(io.grpc.Channel channel,
165165
@java.lang.Override
166166
public io.grpc.examples.routeguide.Feature getFeature(io.grpc.examples.routeguide.Point request) {
167167
return blockingUnaryCall(
168-
channel.newCall(METHOD_GET_FEATURE, callOptions), request);
168+
getChannel().newCall(METHOD_GET_FEATURE, getCallOptions()), request);
169169
}
170170

171171
@java.lang.Override
172172
public java.util.Iterator<io.grpc.examples.routeguide.Feature> listFeatures(
173173
io.grpc.examples.routeguide.Rectangle request) {
174174
return blockingServerStreamingCall(
175-
channel.newCall(METHOD_LIST_FEATURES, callOptions), request);
175+
getChannel().newCall(METHOD_LIST_FEATURES, getCallOptions()), request);
176176
}
177177
}
178178

@@ -197,7 +197,7 @@ protected RouteGuideFutureStub build(io.grpc.Channel channel,
197197
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.routeguide.Feature> getFeature(
198198
io.grpc.examples.routeguide.Point request) {
199199
return futureUnaryCall(
200-
channel.newCall(METHOD_GET_FEATURE, callOptions), request);
200+
getChannel().newCall(METHOD_GET_FEATURE, getCallOptions()), request);
201201
}
202202
}
203203

interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ protected ReconnectServiceStub build(io.grpc.Channel channel,
9898
public void start(com.google.protobuf.EmptyProtos.Empty request,
9999
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
100100
asyncUnaryCall(
101-
channel.newCall(METHOD_START, callOptions), request, responseObserver);
101+
getChannel().newCall(METHOD_START, getCallOptions()), request, responseObserver);
102102
}
103103

104104
@java.lang.Override
105105
public void stop(com.google.protobuf.EmptyProtos.Empty request,
106106
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
107107
asyncUnaryCall(
108-
channel.newCall(METHOD_STOP, callOptions), request, responseObserver);
108+
getChannel().newCall(METHOD_STOP, getCallOptions()), request, responseObserver);
109109
}
110110
}
111111

@@ -129,13 +129,13 @@ protected ReconnectServiceBlockingStub build(io.grpc.Channel channel,
129129
@java.lang.Override
130130
public com.google.protobuf.EmptyProtos.Empty start(com.google.protobuf.EmptyProtos.Empty request) {
131131
return blockingUnaryCall(
132-
channel.newCall(METHOD_START, callOptions), request);
132+
getChannel().newCall(METHOD_START, getCallOptions()), request);
133133
}
134134

135135
@java.lang.Override
136136
public io.grpc.testing.integration.Messages.ReconnectInfo stop(com.google.protobuf.EmptyProtos.Empty request) {
137137
return blockingUnaryCall(
138-
channel.newCall(METHOD_STOP, callOptions), request);
138+
getChannel().newCall(METHOD_STOP, getCallOptions()), request);
139139
}
140140
}
141141

@@ -160,14 +160,14 @@ protected ReconnectServiceFutureStub build(io.grpc.Channel channel,
160160
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> start(
161161
com.google.protobuf.EmptyProtos.Empty request) {
162162
return futureUnaryCall(
163-
channel.newCall(METHOD_START, callOptions), request);
163+
getChannel().newCall(METHOD_START, getCallOptions()), request);
164164
}
165165

166166
@java.lang.Override
167167
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.ReconnectInfo> stop(
168168
com.google.protobuf.EmptyProtos.Empty request) {
169169
return futureUnaryCall(
170-
channel.newCall(METHOD_STOP, callOptions), request);
170+
getChannel().newCall(METHOD_STOP, getCallOptions()), request);
171171
}
172172
}
173173

0 commit comments

Comments
 (0)