mirror of https://github.com/grpc/grpc-java.git
Rename unaryFutureCall to futureUnaryCall
This commit is contained in:
parent
690b26eb93
commit
686dcff217
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
@ -196,7 +196,7 @@ public class TestServiceGrpc {
|
|||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.SimpleResponse> unaryCall(
|
||||
io.grpc.testing.SimpleRequest request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.unaryCall, callOptions), request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
|
|
@ -475,7 +475,7 @@ static void PrintStub(const google::protobuf::ServiceDescriptor* service,
|
|||
<< "Future interface doesn't support streaming. "
|
||||
<< "client_streaming=" << client_streaming << ", "
|
||||
<< "server_streaming=" << server_streaming;
|
||||
(*vars)["calls_method"] = "unaryFutureCall";
|
||||
(*vars)["calls_method"] = "futureUnaryCall";
|
||||
p->Print(
|
||||
*vars,
|
||||
"return $calls_method$(\n"
|
||||
|
@ -658,7 +658,7 @@ void PrintImports(Printer* p, bool generate_nano) {
|
|||
"import static "
|
||||
"io.grpc.stub.ClientCalls.blockingServerStreamingCall;\n"
|
||||
"import static "
|
||||
"io.grpc.stub.ClientCalls.unaryFutureCall;\n"
|
||||
"io.grpc.stub.ClientCalls.futureUnaryCall;\n"
|
||||
"import static "
|
||||
"io.grpc.stub.ServerCalls.asyncUnaryCall;\n"
|
||||
"import static "
|
||||
|
|
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
@ -281,7 +281,7 @@ public class TestServiceGrpc {
|
|||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
|
||||
io.grpc.testing.integration.Test.SimpleRequest request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.unaryCall, callOptions), request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
@ -343,7 +343,7 @@ public class TestServiceGrpc {
|
|||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
|
||||
io.grpc.testing.integration.Test.SimpleRequest request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.unaryCall, callOptions), request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
@ -171,7 +171,7 @@ public class GreeterGrpc {
|
|||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloResponse> sayHello(
|
||||
io.grpc.examples.helloworld.HelloRequest request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.sayHello, callOptions), request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
@ -256,7 +256,7 @@ public class RouteGuideGrpc {
|
|||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.routeguide.Feature> getFeature(
|
||||
io.grpc.examples.routeguide.Point request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.getFeature, callOptions), request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|||
import static io.grpc.stub.ClientCalls.asyncDuplexStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.unaryFutureCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
|
@ -317,14 +317,14 @@ public class TestServiceGrpc {
|
|||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> emptyCall(
|
||||
com.google.protobuf.EmptyProtos.Empty request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.emptyCall, callOptions), request);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> unaryCall(
|
||||
io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return unaryFutureCall(
|
||||
return futureUnaryCall(
|
||||
channel.newCall(config.unaryCall, callOptions), request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public class ClientCalls {
|
|||
*/
|
||||
public static <ReqT, RespT> RespT blockingUnaryCall(ClientCall<ReqT, RespT> call, ReqT param) {
|
||||
try {
|
||||
return getUnchecked(unaryFutureCall(call, param));
|
||||
return getUnchecked(futureUnaryCall(call, param));
|
||||
} catch (Throwable t) {
|
||||
call.cancel();
|
||||
throw Throwables.propagate(t);
|
||||
|
@ -126,7 +126,7 @@ public class ClientCalls {
|
|||
*
|
||||
* @return a future for the single response message.
|
||||
*/
|
||||
public static <ReqT, RespT> ListenableFuture<RespT> unaryFutureCall(
|
||||
public static <ReqT, RespT> ListenableFuture<RespT> futureUnaryCall(
|
||||
ClientCall<ReqT, RespT> call,
|
||||
ReqT param) {
|
||||
GrpcFuture<RespT> responseFuture = new GrpcFuture<RespT>(call);
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ClientCallsTest {
|
|||
|
||||
@Test public void unaryFutureCallSuccess() throws Exception {
|
||||
Integer req = 2;
|
||||
ListenableFuture<String> future = ClientCalls.unaryFutureCall(call, req);
|
||||
ListenableFuture<String> future = ClientCalls.futureUnaryCall(call, req);
|
||||
ArgumentCaptor<ClientCall.Listener<String>> listenerCaptor = ArgumentCaptor.forClass(null);
|
||||
verify(call).start(listenerCaptor.capture(), any(Metadata.Headers.class));
|
||||
ClientCall.Listener<String> listener = listenerCaptor.getValue();
|
||||
|
@ -80,7 +80,7 @@ public class ClientCallsTest {
|
|||
|
||||
@Test public void unaryFutureCallFailed() throws Exception {
|
||||
Integer req = 2;
|
||||
ListenableFuture<String> future = ClientCalls.unaryFutureCall(call, req);
|
||||
ListenableFuture<String> future = ClientCalls.futureUnaryCall(call, req);
|
||||
ArgumentCaptor<ClientCall.Listener<String>> listenerCaptor = ArgumentCaptor.forClass(null);
|
||||
verify(call).start(listenerCaptor.capture(), any(Metadata.Headers.class));
|
||||
ClientCall.Listener<String> listener = listenerCaptor.getValue();
|
||||
|
@ -96,7 +96,7 @@ public class ClientCallsTest {
|
|||
|
||||
@Test public void unaryFutureCallCancelled() throws Exception {
|
||||
Integer req = 2;
|
||||
ListenableFuture<String> future = ClientCalls.unaryFutureCall(call, req);
|
||||
ListenableFuture<String> future = ClientCalls.futureUnaryCall(call, req);
|
||||
ArgumentCaptor<ClientCall.Listener<String>> listenerCaptor = ArgumentCaptor.forClass(null);
|
||||
verify(call).start(listenerCaptor.capture(), any(Metadata.Headers.class));
|
||||
ClientCall.Listener<String> listener = listenerCaptor.getValue();
|
||||
|
|
Loading…
Reference in New Issue