Skip to content

Commit 2ee4d02

Browse files
committed
Rename Call to ClientCalls.
Other classes are already following the convention that ClientFoo for client-side, and ServerFoo for server-side. Call has been the black sheep of the family. - Call -> ClientCall - Calls -> ClientCalls - ForwardingCall* -> ForwardingClientCall*
1 parent 4ee2a65 commit 2ee4d02

File tree

28 files changed

+274
-259
lines changed

28 files changed

+274
-259
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ The 'channel' layer is an abstraction over transport handling that is suitable f
236236

237237
#### Client
238238
* [Channel - client side binding](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/Channel.java)
239-
* [Call](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/Call.java)
239+
* [Client Call](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/ClientCall.java)
240240
* [Client Interceptor](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/ClientInterceptor.java)
241241

242242
#### Server

auth/src/main/java/io/grpc/auth/ClientAuthInterceptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
import com.google.auth.Credentials;
3535
import com.google.common.base.Preconditions;
3636

37-
import io.grpc.Call;
3837
import io.grpc.Channel;
38+
import io.grpc.ClientCall;
3939
import io.grpc.ClientInterceptor;
40-
import io.grpc.ClientInterceptors.CheckedForwardingCall;
40+
import io.grpc.ClientInterceptors.CheckedForwardingClientCall;
4141
import io.grpc.Metadata;
4242
import io.grpc.MethodDescriptor;
4343

@@ -64,11 +64,11 @@ public ClientAuthInterceptor(Credentials credentials, Executor executor) {
6464
}
6565

6666
@Override
67-
public <ReqT, RespT> Call<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method,
67+
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method,
6868
Channel next) {
6969
// TODO(ejona86): If the call fails for Auth reasons, this does not properly propagate info that
7070
// would be in WWW-Authenticate, because it does not yet have access to the header.
71-
return new CheckedForwardingCall<ReqT, RespT>(next.newCall(method)) {
71+
return new CheckedForwardingClientCall<ReqT, RespT>(next.newCall(method)) {
7272
@Override
7373
protected void checkedStart(Listener<RespT> responseListener, Metadata.Headers headers)
7474
throws Exception {

auth/src/test/java/io/grpc/auth/ClientAuthInterceptorTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
import com.google.common.collect.ListMultimap;
4545
import com.google.common.collect.Multimaps;
4646

47-
import io.grpc.Call;
4847
import io.grpc.Channel;
48+
import io.grpc.ClientCall;
4949
import io.grpc.Metadata;
5050
import io.grpc.MethodDescriptor;
5151
import io.grpc.Status;
@@ -82,13 +82,13 @@ public class ClientAuthInterceptorTests {
8282
MethodDescriptor<String, Integer> descriptor;
8383

8484
@Mock
85-
Call.Listener<Integer> listener;
85+
ClientCall.Listener<Integer> listener;
8686

8787
@Mock
8888
Channel channel;
8989

9090
@Mock
91-
Call<String, Integer> call;
91+
ClientCall<String, Integer> call;
9292

9393
ClientAuthInterceptor interceptor;
9494

@@ -109,7 +109,7 @@ public void testCopyCredentialToHeaders() throws IOException {
109109
values.put("Extra-Authorization", "token3");
110110
values.put("Extra-Authorization", "token4");
111111
when(credentials.getRequestMetadata()).thenReturn(Multimaps.asMap(values));
112-
Call<String, Integer> interceptedCall = interceptor.interceptCall(descriptor, channel);
112+
ClientCall<String, Integer> interceptedCall = interceptor.interceptCall(descriptor, channel);
113113
Metadata.Headers headers = new Metadata.Headers();
114114
interceptedCall.start(listener, headers);
115115
verify(call).start(listener, headers);
@@ -125,7 +125,7 @@ public void testCopyCredentialToHeaders() throws IOException {
125125
@Test
126126
public void testCredentialsThrows() throws IOException {
127127
when(credentials.getRequestMetadata()).thenThrow(new IOException("Broken"));
128-
Call<String, Integer> interceptedCall = interceptor.interceptCall(descriptor, channel);
128+
ClientCall<String, Integer> interceptedCall = interceptor.interceptCall(descriptor, channel);
129129
Metadata.Headers headers = new Metadata.Headers();
130130
interceptedCall.start(listener, headers);
131131
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
@@ -146,7 +146,7 @@ public AccessToken refreshAccessToken() throws IOException {
146146
}
147147
};
148148
interceptor = new ClientAuthInterceptor(oAuth2Credentials, Executors.newSingleThreadExecutor());
149-
Call<String, Integer> interceptedCall = interceptor.interceptCall(descriptor, channel);
149+
ClientCall<String, Integer> interceptedCall = interceptor.interceptCall(descriptor, channel);
150150
Metadata.Headers headers = new Metadata.Headers();
151151
interceptedCall.start(listener, headers);
152152
verify(call).start(listener, headers);

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package io.grpc.testing;
22

3-
import static io.grpc.stub.Calls.createMethodDescriptor;
4-
import static io.grpc.stub.Calls.asyncUnaryCall;
5-
import static io.grpc.stub.Calls.asyncServerStreamingCall;
6-
import static io.grpc.stub.Calls.asyncClientStreamingCall;
7-
import static io.grpc.stub.Calls.duplexStreamingCall;
8-
import static io.grpc.stub.Calls.blockingUnaryCall;
9-
import static io.grpc.stub.Calls.blockingServerStreamingCall;
10-
import static io.grpc.stub.Calls.unaryFutureCall;
3+
import static io.grpc.stub.ClientCalls.createMethodDescriptor;
4+
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
5+
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
6+
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
7+
import static io.grpc.stub.ClientCalls.duplexStreamingCall;
8+
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
9+
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
10+
import static io.grpc.stub.ClientCalls.unaryFutureCall;
1111
import static io.grpc.stub.ServerCalls.createMethodDefinition;
1212
import static io.grpc.stub.ServerCalls.asyncUnaryRequestCall;
1313
import static io.grpc.stub.ServerCalls.asyncStreamingRequestCall;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package io.grpc.testing;
22

3-
import static io.grpc.stub.Calls.createMethodDescriptor;
4-
import static io.grpc.stub.Calls.asyncUnaryCall;
5-
import static io.grpc.stub.Calls.asyncServerStreamingCall;
6-
import static io.grpc.stub.Calls.asyncClientStreamingCall;
7-
import static io.grpc.stub.Calls.duplexStreamingCall;
8-
import static io.grpc.stub.Calls.blockingUnaryCall;
9-
import static io.grpc.stub.Calls.blockingServerStreamingCall;
10-
import static io.grpc.stub.Calls.unaryFutureCall;
3+
import static io.grpc.stub.ClientCalls.createMethodDescriptor;
4+
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
5+
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
6+
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
7+
import static io.grpc.stub.ClientCalls.duplexStreamingCall;
8+
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
9+
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
10+
import static io.grpc.stub.ClientCalls.unaryFutureCall;
1111
import static io.grpc.stub.ServerCalls.createMethodDefinition;
1212
import static io.grpc.stub.ServerCalls.asyncUnaryRequestCall;
1313
import static io.grpc.stub.ServerCalls.asyncStreamingRequestCall;

benchmarks/src/jmh/java/io/grpc/benchmarks/netty/AbstractBenchmark.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import com.google.common.util.concurrent.MoreExecutors;
44

5-
import io.grpc.Call;
65
import io.grpc.ChannelImpl;
6+
import io.grpc.ClientCall;
77
import io.grpc.DeferredInputStream;
88
import io.grpc.KnownLength;
99
import io.grpc.Marshaller;
@@ -15,7 +15,7 @@
1515
import io.grpc.ServerImpl;
1616
import io.grpc.ServerServiceDefinition;
1717
import io.grpc.Status;
18-
import io.grpc.stub.Calls;
18+
import io.grpc.stub.ClientCalls;
1919
import io.grpc.stub.StreamObserver;
2020
import io.grpc.transport.netty.NegotiationType;
2121
import io.grpc.transport.netty.NettyChannelBuilder;
@@ -326,7 +326,7 @@ public void onError(Throwable t) {
326326
public void onCompleted() {
327327
if (!done.get()) {
328328
ByteBuf slice = request.slice();
329-
Calls.asyncUnaryCall(channel.newCall(unaryMethod), slice, this);
329+
ClientCalls.asyncUnaryCall(channel.newCall(unaryMethod), slice, this);
330330
}
331331
}
332332
};
@@ -346,10 +346,10 @@ protected void startStreamingCalls(int callsPerChannel,
346346
final long counterDelta) {
347347
for (final ChannelImpl channel : channels) {
348348
for (int i = 0; i < callsPerChannel; i++) {
349-
final Call<ByteBuf, ByteBuf> streamingCall = channel.newCall(pingPongMethod);
349+
final ClientCall<ByteBuf, ByteBuf> streamingCall = channel.newCall(pingPongMethod);
350350
final AtomicReference<StreamObserver<ByteBuf>> requestObserverRef =
351351
new AtomicReference<StreamObserver<ByteBuf>>();
352-
StreamObserver<ByteBuf> requestObserver = Calls.duplexStreamingCall(streamingCall,
352+
StreamObserver<ByteBuf> requestObserver = ClientCalls.duplexStreamingCall(streamingCall,
353353
new StreamObserver<ByteBuf>() {
354354
@Override
355355
public void onValue(ByteBuf value) {
@@ -389,10 +389,10 @@ protected void startFlowControlledStreamingCalls(int callsPerChannel,
389389
final long counterDelta) {
390390
for (final ChannelImpl channel : channels) {
391391
for (int i = 0; i < callsPerChannel; i++) {
392-
final Call<ByteBuf, ByteBuf> streamingCall = channel.newCall(flowControlledStreaming);
392+
final ClientCall<ByteBuf, ByteBuf> streamingCall = channel.newCall(flowControlledStreaming);
393393
final AtomicReference<StreamObserver<ByteBuf>> requestObserverRef =
394394
new AtomicReference<StreamObserver<ByteBuf>>();
395-
StreamObserver<ByteBuf> requestObserver = Calls.duplexStreamingCall(streamingCall,
395+
StreamObserver<ByteBuf> requestObserver = ClientCalls.duplexStreamingCall(streamingCall,
396396
new StreamObserver<ByteBuf>() {
397397
@Override
398398
public void onValue(ByteBuf value) {

benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.grpc.benchmarks.netty;
22

3-
import io.grpc.stub.Calls;
3+
import io.grpc.stub.ClientCalls;
44
import io.netty.buffer.Unpooled;
55

66
import org.openjdk.jmh.annotations.Benchmark;
@@ -50,7 +50,7 @@ public void teardown() throws Exception {
5050
*/
5151
@Benchmark
5252
public void blockingUnary() throws Exception {
53-
Calls.blockingUnaryCall(channels[0].newCall(unaryMethod), Unpooled.EMPTY_BUFFER);
53+
ClientCalls.blockingUnaryCall(channels[0].newCall(unaryMethod), Unpooled.EMPTY_BUFFER);
5454
}
5555

5656
/**

compiler/src/java_plugin/cpp/java_generator.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,21 +618,21 @@ static void PrintService(const ServiceDescriptor* service,
618618
void PrintImports(Printer* p, bool generate_nano) {
619619
p->Print(
620620
"import static "
621-
"io.grpc.stub.Calls.createMethodDescriptor;\n"
621+
"io.grpc.stub.ClientCalls.createMethodDescriptor;\n"
622622
"import static "
623-
"io.grpc.stub.Calls.asyncUnaryCall;\n"
623+
"io.grpc.stub.ClientCalls.asyncUnaryCall;\n"
624624
"import static "
625-
"io.grpc.stub.Calls.asyncServerStreamingCall;\n"
625+
"io.grpc.stub.ClientCalls.asyncServerStreamingCall;\n"
626626
"import static "
627-
"io.grpc.stub.Calls.asyncClientStreamingCall;\n"
627+
"io.grpc.stub.ClientCalls.asyncClientStreamingCall;\n"
628628
"import static "
629-
"io.grpc.stub.Calls.duplexStreamingCall;\n"
629+
"io.grpc.stub.ClientCalls.duplexStreamingCall;\n"
630630
"import static "
631-
"io.grpc.stub.Calls.blockingUnaryCall;\n"
631+
"io.grpc.stub.ClientCalls.blockingUnaryCall;\n"
632632
"import static "
633-
"io.grpc.stub.Calls.blockingServerStreamingCall;\n"
633+
"io.grpc.stub.ClientCalls.blockingServerStreamingCall;\n"
634634
"import static "
635-
"io.grpc.stub.Calls.unaryFutureCall;\n"
635+
"io.grpc.stub.ClientCalls.unaryFutureCall;\n"
636636
"import static "
637637
"io.grpc.stub.ServerCalls.createMethodDefinition;\n"
638638
"import static "

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package io.grpc.testing.integration;
22

3-
import static io.grpc.stub.Calls.createMethodDescriptor;
4-
import static io.grpc.stub.Calls.asyncUnaryCall;
5-
import static io.grpc.stub.Calls.asyncServerStreamingCall;
6-
import static io.grpc.stub.Calls.asyncClientStreamingCall;
7-
import static io.grpc.stub.Calls.duplexStreamingCall;
8-
import static io.grpc.stub.Calls.blockingUnaryCall;
9-
import static io.grpc.stub.Calls.blockingServerStreamingCall;
10-
import static io.grpc.stub.Calls.unaryFutureCall;
3+
import static io.grpc.stub.ClientCalls.createMethodDescriptor;
4+
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
5+
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
6+
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
7+
import static io.grpc.stub.ClientCalls.duplexStreamingCall;
8+
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
9+
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
10+
import static io.grpc.stub.ClientCalls.unaryFutureCall;
1111
import static io.grpc.stub.ServerCalls.createMethodDefinition;
1212
import static io.grpc.stub.ServerCalls.asyncUnaryRequestCall;
1313
import static io.grpc.stub.ServerCalls.asyncStreamingRequestCall;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package io.grpc.testing.integration;
22

3-
import static io.grpc.stub.Calls.createMethodDescriptor;
4-
import static io.grpc.stub.Calls.asyncUnaryCall;
5-
import static io.grpc.stub.Calls.asyncServerStreamingCall;
6-
import static io.grpc.stub.Calls.asyncClientStreamingCall;
7-
import static io.grpc.stub.Calls.duplexStreamingCall;
8-
import static io.grpc.stub.Calls.blockingUnaryCall;
9-
import static io.grpc.stub.Calls.blockingServerStreamingCall;
10-
import static io.grpc.stub.Calls.unaryFutureCall;
3+
import static io.grpc.stub.ClientCalls.createMethodDescriptor;
4+
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
5+
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
6+
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
7+
import static io.grpc.stub.ClientCalls.duplexStreamingCall;
8+
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
9+
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
10+
import static io.grpc.stub.ClientCalls.unaryFutureCall;
1111
import static io.grpc.stub.ServerCalls.createMethodDefinition;
1212
import static io.grpc.stub.ServerCalls.asyncUnaryRequestCall;
1313
import static io.grpc.stub.ServerCalls.asyncStreamingRequestCall;

0 commit comments

Comments
 (0)