compiler: add build option to enable deprecated generated code

partially resolving #1469

The added option for java_plugin `enable_deprecated` is `true` by default in `java_plugin.cpp`, so the generated code for `TestService.java` (`compiler/build.gradle` not setting this option) has all deprecated interfaces and static bindService method.

`./build.gradle` and `examples/build.gradle` set this option explicitly to `false`, so all the other generated classes do not have deprecated code.

Will set `enable_deprecated` to `false` by default in future PR when we are ready.
This commit is contained in:
ZHANG Dapeng 2016-07-21 16:35:18 -07:00 committed by GitHub
parent e23d7ec08a
commit e109125c62
16 changed files with 1483 additions and 1146 deletions

View File

@ -71,7 +71,7 @@ public class BenchmarkServiceGrpc {
/**
*/
@java.lang.Deprecated public static interface BenchmarkService {
public static abstract class BenchmarkServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
@ -79,68 +79,45 @@ public class BenchmarkServiceGrpc {
* The server returns the client payload as-is.
* </pre>
*/
public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver);
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class BenchmarkServiceImplBase implements BenchmarkService, io.grpc.BindableService {
@java.lang.Override
public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_CALL, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return BenchmarkServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Messages.SimpleRequest,
io.grpc.benchmarks.proto.Messages.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Messages.SimpleRequest,
io.grpc.benchmarks.proto.Messages.SimpleResponse>(
this, METHODID_STREAMING_CALL)))
.build();
}
}
/**
*/
@java.lang.Deprecated public static interface BenchmarkServiceBlockingClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.benchmarks.proto.Messages.SimpleResponse unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request);
}
/**
*/
@java.lang.Deprecated public static interface BenchmarkServiceFutureClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Messages.SimpleResponse> unaryCall(
io.grpc.benchmarks.proto.Messages.SimpleRequest request);
}
public static class BenchmarkServiceStub extends io.grpc.stub.AbstractStub<BenchmarkServiceStub>
implements BenchmarkService {
public static class BenchmarkServiceStub extends io.grpc.stub.AbstractStub<BenchmarkServiceStub> {
private BenchmarkServiceStub(io.grpc.Channel channel) {
super(channel);
}
@ -156,14 +133,24 @@ public class BenchmarkServiceGrpc {
return new BenchmarkServiceStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
return asyncBidiStreamingCall(
@ -171,8 +158,9 @@ public class BenchmarkServiceGrpc {
}
}
public static class BenchmarkServiceBlockingStub extends io.grpc.stub.AbstractStub<BenchmarkServiceBlockingStub>
implements BenchmarkServiceBlockingClient {
/**
*/
public static class BenchmarkServiceBlockingStub extends io.grpc.stub.AbstractStub<BenchmarkServiceBlockingStub> {
private BenchmarkServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -188,15 +176,21 @@ public class BenchmarkServiceGrpc {
return new BenchmarkServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.benchmarks.proto.Messages.SimpleResponse unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
}
}
public static class BenchmarkServiceFutureStub extends io.grpc.stub.AbstractStub<BenchmarkServiceFutureStub>
implements BenchmarkServiceFutureClient {
/**
*/
public static class BenchmarkServiceFutureStub extends io.grpc.stub.AbstractStub<BenchmarkServiceFutureStub> {
private BenchmarkServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -212,7 +206,12 @@ public class BenchmarkServiceGrpc {
return new BenchmarkServiceFutureStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Messages.SimpleResponse> unaryCall(
io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
return futureUnaryCall(
@ -220,8 +219,6 @@ public class BenchmarkServiceGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractBenchmarkService extends BenchmarkServiceImplBase {}
private static final int METHODID_UNARY_CALL = 0;
private static final int METHODID_STREAMING_CALL = 1;
@ -230,10 +227,10 @@ public class BenchmarkServiceGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final BenchmarkService serviceImpl;
private final BenchmarkServiceImplBase serviceImpl;
private final int methodId;
public MethodHandlers(BenchmarkService serviceImpl, int methodId) {
public MethodHandlers(BenchmarkServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -271,23 +268,4 @@ public class BenchmarkServiceGrpc {
METHOD_STREAMING_CALL);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final BenchmarkService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Messages.SimpleRequest,
io.grpc.benchmarks.proto.Messages.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Messages.SimpleRequest,
io.grpc.benchmarks.proto.Messages.SimpleResponse>(
serviceImpl, METHODID_STREAMING_CALL)))
.build();
}
}

View File

@ -89,7 +89,7 @@ public class WorkerServiceGrpc {
/**
*/
@java.lang.Deprecated public static interface WorkerService {
public static abstract class WorkerServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
@ -102,7 +102,9 @@ public class WorkerServiceGrpc {
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerArgs> runServer(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerStatus> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerStatus> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_RUN_SERVER, responseObserver);
}
/**
* <pre>
@ -115,7 +117,9 @@ public class WorkerServiceGrpc {
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientArgs> runClient(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientStatus> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientStatus> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_RUN_CLIENT, responseObserver);
}
/**
* <pre>
@ -123,91 +127,57 @@ public class WorkerServiceGrpc {
* </pre>
*/
public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.CoreResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.CoreResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_CORE_COUNT, responseObserver);
}
/**
* <pre>
* Quit this worker
* </pre>
*/
public void quitWorker(io.grpc.benchmarks.proto.Control.Void request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class WorkerServiceImplBase implements WorkerService, io.grpc.BindableService {
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerArgs> runServer(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerStatus> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_RUN_SERVER, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientArgs> runClient(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientStatus> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_RUN_CLIENT, responseObserver);
}
@java.lang.Override
public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.CoreResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_CORE_COUNT, responseObserver);
}
@java.lang.Override
public void quitWorker(io.grpc.benchmarks.proto.Control.Void request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_QUIT_WORKER, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return WorkerServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_RUN_SERVER,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.ServerArgs,
io.grpc.benchmarks.proto.Control.ServerStatus>(
this, METHODID_RUN_SERVER)))
.addMethod(
METHOD_RUN_CLIENT,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.ClientArgs,
io.grpc.benchmarks.proto.Control.ClientStatus>(
this, METHODID_RUN_CLIENT)))
.addMethod(
METHOD_CORE_COUNT,
asyncUnaryCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.CoreRequest,
io.grpc.benchmarks.proto.Control.CoreResponse>(
this, METHODID_CORE_COUNT)))
.addMethod(
METHOD_QUIT_WORKER,
asyncUnaryCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.Void,
io.grpc.benchmarks.proto.Control.Void>(
this, METHODID_QUIT_WORKER)))
.build();
}
}
/**
*/
@java.lang.Deprecated public static interface WorkerServiceBlockingClient {
/**
* <pre>
* Just return the core count - unary call
* </pre>
*/
public io.grpc.benchmarks.proto.Control.CoreResponse coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request);
/**
* <pre>
* Quit this worker
* </pre>
*/
public io.grpc.benchmarks.proto.Control.Void quitWorker(io.grpc.benchmarks.proto.Control.Void request);
}
/**
*/
@java.lang.Deprecated public static interface WorkerServiceFutureClient {
/**
* <pre>
* Just return the core count - unary call
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.CoreResponse> coreCount(
io.grpc.benchmarks.proto.Control.CoreRequest request);
/**
* <pre>
* Quit this worker
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.Void> quitWorker(
io.grpc.benchmarks.proto.Control.Void request);
}
public static class WorkerServiceStub extends io.grpc.stub.AbstractStub<WorkerServiceStub>
implements WorkerService {
public static class WorkerServiceStub extends io.grpc.stub.AbstractStub<WorkerServiceStub> {
private WorkerServiceStub(io.grpc.Channel channel) {
super(channel);
}
@ -223,28 +193,54 @@ public class WorkerServiceGrpc {
return new WorkerServiceStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Start server with specified workload.
* First request sent specifies the ServerConfig followed by ServerStatus
* response. After that, a "Mark" can be sent anytime to request the latest
* stats. Closing the stream will initiate shutdown of the test server
* and once the shutdown has finished, the OK status is sent to terminate
* this RPC.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerArgs> runServer(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerStatus> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(METHOD_RUN_SERVER, getCallOptions()), responseObserver);
}
@java.lang.Override
/**
* <pre>
* Start client with specified workload.
* First request sent specifies the ClientConfig followed by ClientStatus
* response. After that, a "Mark" can be sent anytime to request the latest
* stats. Closing the stream will initiate shutdown of the test client
* and once the shutdown has finished, the OK status is sent to terminate
* this RPC.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientArgs> runClient(
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientStatus> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(METHOD_RUN_CLIENT, getCallOptions()), responseObserver);
}
@java.lang.Override
/**
* <pre>
* Just return the core count - unary call
* </pre>
*/
public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.CoreResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_CORE_COUNT, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
* <pre>
* Quit this worker
* </pre>
*/
public void quitWorker(io.grpc.benchmarks.proto.Control.Void request,
io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver) {
asyncUnaryCall(
@ -252,8 +248,9 @@ public class WorkerServiceGrpc {
}
}
public static class WorkerServiceBlockingStub extends io.grpc.stub.AbstractStub<WorkerServiceBlockingStub>
implements WorkerServiceBlockingClient {
/**
*/
public static class WorkerServiceBlockingStub extends io.grpc.stub.AbstractStub<WorkerServiceBlockingStub> {
private WorkerServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -269,21 +266,30 @@ public class WorkerServiceGrpc {
return new WorkerServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Just return the core count - unary call
* </pre>
*/
public io.grpc.benchmarks.proto.Control.CoreResponse coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_CORE_COUNT, getCallOptions(), request);
}
@java.lang.Override
/**
* <pre>
* Quit this worker
* </pre>
*/
public io.grpc.benchmarks.proto.Control.Void quitWorker(io.grpc.benchmarks.proto.Control.Void request) {
return blockingUnaryCall(
getChannel(), METHOD_QUIT_WORKER, getCallOptions(), request);
}
}
public static class WorkerServiceFutureStub extends io.grpc.stub.AbstractStub<WorkerServiceFutureStub>
implements WorkerServiceFutureClient {
/**
*/
public static class WorkerServiceFutureStub extends io.grpc.stub.AbstractStub<WorkerServiceFutureStub> {
private WorkerServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -299,14 +305,22 @@ public class WorkerServiceGrpc {
return new WorkerServiceFutureStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Just return the core count - unary call
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.CoreResponse> coreCount(
io.grpc.benchmarks.proto.Control.CoreRequest request) {
return futureUnaryCall(
getChannel().newCall(METHOD_CORE_COUNT, getCallOptions()), request);
}
@java.lang.Override
/**
* <pre>
* Quit this worker
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.Void> quitWorker(
io.grpc.benchmarks.proto.Control.Void request) {
return futureUnaryCall(
@ -314,8 +328,6 @@ public class WorkerServiceGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractWorkerService extends WorkerServiceImplBase {}
private static final int METHODID_CORE_COUNT = 0;
private static final int METHODID_QUIT_WORKER = 1;
private static final int METHODID_RUN_SERVER = 2;
@ -326,10 +338,10 @@ public class WorkerServiceGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final WorkerService serviceImpl;
private final WorkerServiceImplBase serviceImpl;
private final int methodId;
public MethodHandlers(WorkerService serviceImpl, int methodId) {
public MethodHandlers(WorkerServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -376,37 +388,4 @@ public class WorkerServiceGrpc {
METHOD_QUIT_WORKER);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final WorkerService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_RUN_SERVER,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.ServerArgs,
io.grpc.benchmarks.proto.Control.ServerStatus>(
serviceImpl, METHODID_RUN_SERVER)))
.addMethod(
METHOD_RUN_CLIENT,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.ClientArgs,
io.grpc.benchmarks.proto.Control.ClientStatus>(
serviceImpl, METHODID_RUN_CLIENT)))
.addMethod(
METHOD_CORE_COUNT,
asyncUnaryCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.CoreRequest,
io.grpc.benchmarks.proto.Control.CoreResponse>(
serviceImpl, METHODID_CORE_COUNT)))
.addMethod(
METHOD_QUIT_WORKER,
asyncUnaryCall(
new MethodHandlers<
io.grpc.benchmarks.proto.Control.Void,
io.grpc.benchmarks.proto.Control.Void>(
serviceImpl, METHODID_QUIT_WORKER)))
.build();
}
}

View File

@ -95,7 +95,11 @@ subprojects {
// it's possible the version of protoc has been changed.
task.inputs.file "${rootProject.projectDir}/build.gradle"
task.plugins {
grpc {}
grpc {
// To generate deprecated interfaces and static bindService method,
// turn the enable_deprecated option to true below:
option 'enable_deprecated=false'
}
}
}
}

View File

@ -427,110 +427,137 @@ enum CallType {
FUTURE_CALL = 2
};
static void PrintBindServiceMethodBody(const ServiceDescriptor* service,
map<string, string>* vars,
Printer* p,
bool generate_nano);
static void PrintDeprecatedDocComment(const ServiceDescriptor* service,
map<string, string>* vars,
Printer* p) {
p->Print(
*vars,
"/**\n"
" * This will be removed in the next release.\n"
" * If your code has been using gRPC-java v0.15.0 or higher already,\n"
" * the following changes to your code are suggested:\n"
" * <ul>\n"
" * <li> replace {@code extends/implements $service_name$}"
" with {@code extends $service_name$ImplBase} for server side;</li>\n"
" * <li> replace {@code $service_name$} with {@code $service_name$Stub} for client side;"
"</li>\n"
" * <li> replace usage of {@code $service_name$} with {@code $service_name$ImplBase};"
"</li>\n"
" * <li> replace usage of {@code Abstract$service_name$}"
" with {@link $service_name$ImplBase};</li>\n"
" * <li> replace"
" {@code serverBuilder.addService($service_class_name$.bindService(serviceImpl))}\n"
" * with {@code serverBuilder.addService(serviceImpl)};</li>\n"
" * <li> if you are mocking stubs using mockito, please do not mock them.\n"
" * See the documentation on testing with gRPC-java;</li>\n"
" * <li> replace {@code $service_name$BlockingClient}"
" with {@link $service_name$BlockingStub};</li>\n"
" * <li> replace {@code $service_name$FutureClient}"
" with {@link $service_name$FutureStub}.</li>\n"
" * </ul>\n"
" */\n");
}
// Prints a client interface or implementation class, or a server interface.
static void PrintStub(
const ServiceDescriptor* service,
map<string, string>* vars,
Printer* p, StubType type, bool generate_nano) {
(*vars)["service_name"] = service->name();
(*vars)["abstract_name"] = service->name() + "ImplBase";
string interface_name = service->name();
string impl_name = service->name();
bool abstract = false;
Printer* p, StubType type, bool generate_nano,
bool enable_deprecated) {
const string service_name = service->name();
(*vars)["service_name"] = service_name;
(*vars)["abstract_name"] = service_name + "ImplBase";
string stub_name = service_name;
string client_name = service_name;
CallType call_type;
bool impl_base = false;
bool interface = false;
switch (type) {
case ABSTRACT_CLASS:
abstract = true;
call_type = ASYNC_CALL;
impl_base = true;
break;
case ASYNC_INTERFACE:
case ASYNC_CLIENT_IMPL:
impl_name += "Stub";
call_type = ASYNC_CALL;
stub_name += "Stub";
break;
case BLOCKING_CLIENT_INTERFACE:
interface = true;
case BLOCKING_CLIENT_IMPL:
interface_name += "BlockingClient";
impl_name += "BlockingStub";
call_type = BLOCKING_CALL;
stub_name += "BlockingStub";
client_name += "BlockingClient";
break;
case FUTURE_CLIENT_INTERFACE:
interface = true;
case FUTURE_CLIENT_IMPL:
interface_name += "FutureClient";
impl_name += "FutureStub";
call_type = FUTURE_CALL;
stub_name += "FutureStub";
client_name += "FutureClient";
break;
case BLOCKING_SERVER_INTERFACE:
interface_name += "BlockingServer";
case ASYNC_INTERFACE:
call_type = ASYNC_CALL;
interface = true;
break;
default:
GRPC_CODEGEN_FAIL << "Cannot determine class name for StubType: " << type;
}
CallType call_type;
bool impl = false;
switch (type) {
case ABSTRACT_CLASS:
case ASYNC_INTERFACE:
call_type = ASYNC_CALL;
impl = false;
break;
case BLOCKING_CLIENT_INTERFACE:
case BLOCKING_SERVER_INTERFACE:
call_type = BLOCKING_CALL;
impl = false;
break;
case FUTURE_CLIENT_INTERFACE:
call_type = FUTURE_CALL;
impl = false;
break;
case ASYNC_CLIENT_IMPL:
call_type = ASYNC_CALL;
impl = true;
break;
case BLOCKING_CLIENT_IMPL:
call_type = BLOCKING_CALL;
impl = true;
break;
case FUTURE_CLIENT_IMPL:
call_type = FUTURE_CALL;
impl = true;
break;
default:
GRPC_CODEGEN_FAIL << "Cannot determine call type for StubType: " << type;
}
(*vars)["interface_name"] = interface_name;
(*vars)["impl_name"] = impl_name;
(*vars)["stub_name"] = stub_name;
(*vars)["client_name"] = client_name;
bool interface = !abstract && !impl;
// Class head
if (abstract) {
p->Print(
*vars,
"@$ExperimentalApi$(\"https://github.com/grpc/grpc-java/issues/1469\")\n"
"public static abstract class $abstract_name$ implements $service_name$, "
"$BindableService$ {\n");
} else if (interface) {
// TODO(nmittler): Replace with WriteServiceDocComment when included in protobuf distribution.
// Print the service-level javadoc when we define the interface.
if (!interface) {
GrpcWriteServiceDocComment(p, service);
p->Print(
*vars,
"@$Deprecated$ public static interface $interface_name$ {\n");
}
if (impl_base) {
if (enable_deprecated) {
p->Print(
*vars,
"public static abstract class $abstract_name$ implements $BindableService$, "
"$service_name$ {\n");
}
else {
p->Print(
*vars,
"public static abstract class $abstract_name$ implements $BindableService$ {\n");
}
} else {
p->Print(
*vars,
"public static class $impl_name$ extends $AbstractStub$<$impl_name$>\n"
" implements $interface_name$ {\n");
if (enable_deprecated) {
if (interface) {
p->Print(
*vars,
"@$Deprecated$ public static interface $client_name$ {\n");
} else {
p->Print(
*vars,
"public static class $stub_name$ extends $AbstractStub$<$stub_name$>\n"
" implements $client_name$ {\n");
}
} else {
p->Print(
*vars,
"public static class $stub_name$ extends $AbstractStub$<$stub_name$> {\n");
}
}
p->Indent();
// Constructor and build() method
if (impl) {
if (!impl_base && !interface) {
p->Print(
*vars,
"private $impl_name$($Channel$ channel) {\n");
"private $stub_name$($Channel$ channel) {\n");
p->Indent();
p->Print("super(channel);\n");
p->Outdent();
p->Print("}\n\n");
p->Print(
*vars,
"private $impl_name$($Channel$ channel,\n"
"private $stub_name$($Channel$ channel,\n"
" $CallOptions$ callOptions) {\n");
p->Indent();
p->Print("super(channel, callOptions);\n");
@ -539,12 +566,12 @@ static void PrintStub(
p->Print(
*vars,
"@$Override$\n"
"protected $impl_name$ build($Channel$ channel,\n"
"protected $stub_name$ build($Channel$ channel,\n"
" $CallOptions$ callOptions) {\n");
p->Indent();
p->Print(
*vars,
"return new $impl_name$(channel, callOptions);\n");
"return new $stub_name$(channel, callOptions);\n");
p->Outdent();
p->Print("}\n");
}
@ -573,20 +600,18 @@ static void PrintStub(
// Method signature
p->Print("\n");
if (interface) {
// TODO(nmittler): Replace with WriteMethodDocComment once included by the protobuf distro.
// TODO(nmittler): Replace with WriteMethodDocComment once included by the protobuf distro.
if (!interface) {
GrpcWriteMethodDocComment(p, method);
} else {
p->Print(
*vars,
"@$Override$\n");
if (enable_deprecated) {
p->Print(
*vars,
"@$Override$\n");
}
}
p->Print("public ");
switch (call_type) {
case BLOCKING_CALL:
// TODO(zhangkun83): decide the blocking server interface
GRPC_CODEGEN_CHECK(type != BLOCKING_SERVER_INTERFACE)
<< "Blocking server interface is not available";
GRPC_CODEGEN_CHECK(!client_streaming)
<< "Blocking client interface with client streaming is unavailable";
if (server_streaming) {
@ -629,17 +654,14 @@ static void PrintStub(
break;
}
if (!(abstract || impl)) {
// Interface method - there will be no body, close method.
if (interface) {
p->Print(";\n");
continue;
}
// Method body for abstract stub & client impls.
// Method body.
p->Print(" {\n");
p->Indent();
if (abstract) {
if (impl_base) {
switch (call_type) {
// NB: Skipping validation of service methods. If something is wrong, we wouldn't get to
// this point as compiler would return errors when generating service interface.
@ -657,7 +679,7 @@ static void PrintStub(
default:
break;
}
} else if (impl) {
} else if (!interface) {
switch (call_type) {
case BLOCKING_CALL:
GRPC_CODEGEN_CHECK(!client_streaming)
@ -715,16 +737,13 @@ static void PrintStub(
p->Print("}\n");
}
if (abstract) {
if (impl_base) {
p->Print("\n");
p->Print(*vars,
"@$Override$ public $ServerServiceDefinition$ bindService() {\n"
);
p->Indent();
p->Print(*vars,
"return $service_class_name$.bindService(this);\n"
);
p->Outdent();
p->Print(
*vars,
"@$Override$ public $ServerServiceDefinition$ bindService() {\n");
(*vars)["instance"] = "this";
PrintBindServiceMethodBody(service, vars, p, generate_nano);
p->Print("}\n");
}
@ -743,7 +762,8 @@ static bool CompareMethodClientStreaming(const MethodDescriptor* method1,
static void PrintMethodHandlerClass(const ServiceDescriptor* service,
map<string, string>* vars,
Printer* p,
bool generate_nano) {
bool generate_nano,
bool enable_deprecated) {
// Sort method ids based on client_streaming() so switch tables are compact.
vector<const MethodDescriptor*> sorted_methods(service->method_count());
for (int i = 0; i < service->method_count(); ++i) {
@ -760,7 +780,11 @@ static void PrintMethodHandlerClass(const ServiceDescriptor* service,
"private static final int $method_id_name$ = $method_id$;\n");
}
p->Print("\n");
(*vars)["service_name"] = service->name();
if (enable_deprecated) {
(*vars)["service_name"] = service->name();
} else {
(*vars)["service_name"] = service->name() + "ImplBase";
}
p->Print(
*vars,
"private static class MethodHandlers<Req, Resp> implements\n"
@ -876,15 +900,11 @@ static void PrintGetServiceDescriptorMethod(const ServiceDescriptor* service,
p->Print("}\n\n");
}
static void PrintBindServiceMethod(const ServiceDescriptor* service,
static void PrintBindServiceMethodBody(const ServiceDescriptor* service,
map<string, string>* vars,
Printer* p,
bool generate_nano) {
(*vars)["service_name"] = service->name();
p->Print(
*vars,
"@$Deprecated$ public static $ServerServiceDefinition$ bindService(\n"
" final $service_name$ serviceImpl) {\n");
p->Indent();
p->Print(*vars,
"return "
@ -927,7 +947,7 @@ static void PrintBindServiceMethod(const ServiceDescriptor* service,
"new MethodHandlers<\n"
" $input_type$,\n"
" $output_type$>(\n"
" serviceImpl, $method_id_name$)))\n");
" $instance$, $method_id_name$)))\n");
p->Outdent();
p->Outdent();
}
@ -935,13 +955,13 @@ static void PrintBindServiceMethod(const ServiceDescriptor* service,
p->Outdent();
p->Outdent();
p->Outdent();
p->Print("}\n");
}
static void PrintService(const ServiceDescriptor* service,
map<string, string>* vars,
Printer* p,
ProtoFlavor flavor) {
ProtoFlavor flavor,
bool enable_deprecated) {
(*vars)["service_name"] = service->name();
(*vars)["file_name"] = service->file()->name();
(*vars)["service_class_name"] = ServiceClassName(service);
@ -1011,19 +1031,39 @@ static void PrintService(const ServiceDescriptor* service,
p->Print("}\n\n");
bool generate_nano = flavor == ProtoFlavor::NANO;
PrintStub(service, vars, p, ASYNC_INTERFACE, generate_nano);
PrintStub(service, vars, p, ABSTRACT_CLASS, generate_nano);
PrintStub(service, vars, p, BLOCKING_CLIENT_INTERFACE, generate_nano);
PrintStub(service, vars, p, FUTURE_CLIENT_INTERFACE, generate_nano);
PrintStub(service, vars, p, ASYNC_CLIENT_IMPL, generate_nano);
PrintStub(service, vars, p, BLOCKING_CLIENT_IMPL, generate_nano);
PrintStub(service, vars, p, FUTURE_CLIENT_IMPL, generate_nano);
p->Print(*vars,
"@$Deprecated$ public static abstract class Abstract$service_name$"
" extends $service_name$ImplBase {}\n\n");
PrintMethodHandlerClass(service, vars, p, generate_nano);
PrintStub(service, vars, p, ABSTRACT_CLASS, generate_nano, enable_deprecated);
PrintStub(service, vars, p, ASYNC_CLIENT_IMPL, generate_nano, enable_deprecated);
PrintStub(service, vars, p, BLOCKING_CLIENT_IMPL, generate_nano, enable_deprecated);
PrintStub(service, vars, p, FUTURE_CLIENT_IMPL, generate_nano, enable_deprecated);
if (enable_deprecated) {
PrintDeprecatedDocComment(service, vars, p);
PrintStub(service, vars, p, ASYNC_INTERFACE, generate_nano, true);
PrintDeprecatedDocComment(service, vars, p);
PrintStub(service, vars, p, BLOCKING_CLIENT_INTERFACE, generate_nano, true);
PrintDeprecatedDocComment(service, vars, p);
PrintStub(service, vars, p, FUTURE_CLIENT_INTERFACE, generate_nano, true);
PrintDeprecatedDocComment(service, vars, p);
p->Print(
*vars,
"@$Deprecated$ public static abstract class Abstract$service_name$"
" extends $service_name$ImplBase {}\n\n");
// static bindService method
PrintDeprecatedDocComment(service, vars, p);
p->Print(
*vars,
"@$Deprecated$ public static $ServerServiceDefinition$ bindService("
"final $service_name$ serviceImpl) {\n");
(*vars)["instance"] = "serviceImpl";
PrintBindServiceMethodBody(service, vars, p, generate_nano);
p->Print(
*vars,
"}\n\n");
}
PrintMethodHandlerClass(service, vars, p, generate_nano, enable_deprecated);
PrintGetServiceDescriptorMethod(service, vars, p, generate_nano);
PrintBindServiceMethod(service, vars, p, generate_nano);
p->Outdent();
p->Print("}\n");
}
@ -1065,7 +1105,8 @@ void PrintImports(Printer* p, bool generate_nano) {
void GenerateService(const ServiceDescriptor* service,
google::protobuf::io::ZeroCopyOutputStream* out,
ProtoFlavor flavor) {
ProtoFlavor flavor,
bool enable_deprecated) {
// All non-generated classes must be referred by fully qualified names to
// avoid collision with generated classes.
map<string, string> vars;
@ -1112,7 +1153,7 @@ void GenerateService(const ServiceDescriptor* service,
if (!vars["Package"].empty()) {
vars["Package"].append(".");
}
PrintService(service, &vars, &printer, flavor);
PrintService(service, &vars, &printer, flavor, enable_deprecated);
}
string ServiceJavaPackage(const FileDescriptor* file, bool nano) {

View File

@ -52,7 +52,8 @@ string ServiceClassName(const google::protobuf::ServiceDescriptor* service);
// Writes the generated service interface into the given ZeroCopyOutputStream
void GenerateService(const google::protobuf::ServiceDescriptor* service,
google::protobuf::io::ZeroCopyOutputStream* out,
ProtoFlavor flavor);
ProtoFlavor flavor,
bool enable_deprecated);
} // namespace java_grpc_generator

View File

@ -37,11 +37,16 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
java_grpc_generator::ProtoFlavor flavor =
java_grpc_generator::ProtoFlavor::NORMAL;
// TODO(zdapeng): turn the default value to false
bool enable_deprecated = true;
for (int i = 0; i < options.size(); i++) {
if (options[i].first == "nano") {
flavor = java_grpc_generator::ProtoFlavor::NANO;
} else if (options[i].first == "lite") {
flavor = java_grpc_generator::ProtoFlavor::LITE;
} else if (options[i].first == "enable_deprecated") {
enable_deprecated = options[i].second == "true";
}
}
@ -54,7 +59,7 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
+ java_grpc_generator::ServiceClassName(service) + ".java";
std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->Open(filename));
java_grpc_generator::GenerateService(service, output.get(), flavor);
java_grpc_generator::GenerateService(service, output.get(), flavor, enable_deprecated);
}
return true;
}

View File

@ -104,7 +104,7 @@ public class TestServiceGrpc {
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestService {
public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService {
/**
* <pre>
@ -112,8 +112,11 @@ public class TestServiceGrpc {
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
/**
* <pre>
@ -121,8 +124,11 @@ public class TestServiceGrpc {
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
/**
* <pre>
@ -130,8 +136,11 @@ public class TestServiceGrpc {
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
/**
* <pre>
@ -140,8 +149,11 @@ public class TestServiceGrpc {
* demonstrates the idea of full bidirectionality.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
}
/**
* <pre>
@ -151,37 +163,6 @@ public class TestServiceGrpc {
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class TestServiceImplBase implements TestService, io.grpc.BindableService {
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -189,7 +170,43 @@ public class TestServiceGrpc {
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return TestServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Test.SimpleRequest,
io.grpc.testing.integration.Test.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
this, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
this, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
this, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
this, METHODID_HALF_BIDI_CALL)))
.build();
}
}
@ -198,43 +215,6 @@ public class TestServiceGrpc {
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request);
}
public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
implements TestService {
private TestServiceStub(io.grpc.Channel channel) {
@ -252,6 +232,12 @@ public class TestServiceGrpc {
return new TestServiceStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
@ -259,6 +245,12 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -266,6 +258,12 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
@ -273,6 +271,13 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full bidirectionality.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -280,6 +285,14 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -288,6 +301,11 @@ public class TestServiceGrpc {
}
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
implements TestServiceBlockingClient {
private TestServiceBlockingStub(io.grpc.Channel channel) {
@ -305,12 +323,24 @@ public class TestServiceGrpc {
return new TestServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
@ -319,6 +349,11 @@ public class TestServiceGrpc {
}
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
implements TestServiceFutureClient {
private TestServiceFutureStub(io.grpc.Channel channel) {
@ -336,6 +371,12 @@ public class TestServiceGrpc {
return new TestServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request) {
@ -344,8 +385,165 @@ public class TestServiceGrpc {
}
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestService {
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Test.SimpleRequest,
io.grpc.testing.integration.Test.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_BIDI_CALL)))
.build();
}
private static final int METHODID_UNARY_CALL = 0;
private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
private static final int METHODID_STREAMING_INPUT_CALL = 2;
@ -411,44 +609,4 @@ public class TestServiceGrpc {
METHOD_HALF_BIDI_CALL);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Test.SimpleRequest,
io.grpc.testing.integration.Test.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_BIDI_CALL)))
.build();
}
}

View File

@ -104,7 +104,7 @@ public class TestServiceGrpc {
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestService {
public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService {
/**
* <pre>
@ -112,8 +112,11 @@ public class TestServiceGrpc {
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
/**
* <pre>
@ -121,8 +124,11 @@ public class TestServiceGrpc {
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
/**
* <pre>
@ -130,8 +136,11 @@ public class TestServiceGrpc {
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
/**
* <pre>
@ -140,8 +149,11 @@ public class TestServiceGrpc {
* demonstrates the idea of full bidirectionality.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
}
/**
* <pre>
@ -151,37 +163,6 @@ public class TestServiceGrpc {
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class TestServiceImplBase implements TestService, io.grpc.BindableService {
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -189,7 +170,43 @@ public class TestServiceGrpc {
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return TestServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Test.SimpleRequest,
io.grpc.testing.integration.Test.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
this, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
this, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
this, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
this, METHODID_HALF_BIDI_CALL)))
.build();
}
}
@ -198,43 +215,6 @@ public class TestServiceGrpc {
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request);
}
public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
implements TestService {
private TestServiceStub(io.grpc.Channel channel) {
@ -252,6 +232,12 @@ public class TestServiceGrpc {
return new TestServiceStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
@ -259,6 +245,12 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -266,6 +258,12 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
@ -273,6 +271,13 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full bidirectionality.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -280,6 +285,14 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
@ -288,6 +301,11 @@ public class TestServiceGrpc {
}
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
implements TestServiceBlockingClient {
private TestServiceBlockingStub(io.grpc.Channel channel) {
@ -305,12 +323,24 @@ public class TestServiceGrpc {
return new TestServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
@ -319,6 +349,11 @@ public class TestServiceGrpc {
}
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
implements TestServiceFutureClient {
private TestServiceFutureStub(io.grpc.Channel channel) {
@ -336,6 +371,12 @@ public class TestServiceGrpc {
return new TestServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request) {
@ -344,8 +385,165 @@ public class TestServiceGrpc {
}
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestService {
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Test.SimpleRequest,
io.grpc.testing.integration.Test.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_BIDI_CALL)))
.build();
}
private static final int METHODID_UNARY_CALL = 0;
private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
private static final int METHODID_STREAMING_INPUT_CALL = 2;
@ -411,44 +609,4 @@ public class TestServiceGrpc {
METHOD_HALF_BIDI_CALL);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Test.SimpleRequest,
io.grpc.testing.integration.Test.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_BIDI_CALL)))
.build();
}
}

View File

@ -182,7 +182,7 @@ public class TestServiceGrpc {
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestService {
public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService {
/**
* <pre>
@ -190,8 +190,11 @@ public class TestServiceGrpc {
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
/**
* <pre>
@ -199,8 +202,11 @@ public class TestServiceGrpc {
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
/**
* <pre>
@ -208,8 +214,11 @@ public class TestServiceGrpc {
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
/**
* <pre>
@ -218,8 +227,11 @@ public class TestServiceGrpc {
* demonstrates the idea of full bidirectionality.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
}
/**
* <pre>
@ -229,37 +241,6 @@ public class TestServiceGrpc {
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class TestServiceImplBase implements TestService, io.grpc.BindableService {
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
@ -267,7 +248,43 @@ public class TestServiceGrpc {
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return TestServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.SimpleRequest,
io.grpc.testing.integration.nano.Test.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
this, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
this, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
this, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
this, METHODID_HALF_BIDI_CALL)))
.build();
}
}
@ -276,43 +293,6 @@ public class TestServiceGrpc {
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.nano.Test.SimpleRequest request);
}
public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
implements TestService {
private TestServiceStub(io.grpc.Channel channel) {
@ -330,6 +310,12 @@ public class TestServiceGrpc {
return new TestServiceStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
@ -337,6 +323,12 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
@ -344,6 +336,12 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
}
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
@ -351,6 +349,13 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full bidirectionality.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
@ -358,6 +363,14 @@ public class TestServiceGrpc {
getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
}
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
@ -366,6 +379,11 @@ public class TestServiceGrpc {
}
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
implements TestServiceBlockingClient {
private TestServiceBlockingStub(io.grpc.Channel channel) {
@ -383,12 +401,24 @@ public class TestServiceGrpc {
return new TestServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
}
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
@java.lang.Override
public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
@ -397,6 +427,11 @@ public class TestServiceGrpc {
}
}
/**
* <pre>
* Test service that supports all call types.
* </pre>
*/
public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
implements TestServiceFutureClient {
private TestServiceFutureStub(io.grpc.Channel channel) {
@ -414,6 +449,12 @@ public class TestServiceGrpc {
return new TestServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* One request followed by one response.
* The server returns the client payload as-is.
* </pre>
*/
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.nano.Test.SimpleRequest request) {
@ -422,8 +463,165 @@ public class TestServiceGrpc {
}
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestService {
public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.nano.Test.SimpleRequest request);
}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
/**
* This will be removed in the next release.
* If your code has been using gRPC-java v0.15.0 or higher already,
* the following changes to your code are suggested:
* <ul>
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
* with {@code serverBuilder.addService(serviceImpl)};</li>
* <li> if you are mocking stubs using mockito, please do not mock them.
* See the documentation on testing with gRPC-java;</li>
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
* </ul>
*/
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.SimpleRequest,
io.grpc.testing.integration.nano.Test.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_BIDI_CALL)))
.build();
}
private static final int METHODID_UNARY_CALL = 0;
private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
private static final int METHODID_STREAMING_INPUT_CALL = 2;
@ -489,44 +687,4 @@ public class TestServiceGrpc {
METHOD_HALF_BIDI_CALL);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.SimpleRequest,
io.grpc.testing.integration.nano.Test.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_BIDI_CALL)))
.addMethod(
METHOD_HALF_BIDI_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_BIDI_CALL)))
.build();
}
}

View File

@ -44,7 +44,11 @@ protobuf {
}
generateProtoTasks {
all()*.plugins {
grpc {}
grpc {
// To generate deprecated interfaces and static bindService method,
// turn the enable_deprecated option to true below:
option 'enable_deprecated=false'
}
}
}
}

View File

@ -62,43 +62,34 @@ public class LoadBalancerGrpc {
/**
*/
@java.lang.Deprecated public static interface LoadBalancer {
public static abstract class LoadBalancerImplBase implements io.grpc.BindableService {
/**
* <pre>
* Bidirectional rpc to get a list of servers.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.grpclb.LoadBalanceRequest> balanceLoad(
io.grpc.stub.StreamObserver<io.grpc.grpclb.LoadBalanceResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class LoadBalancerImplBase implements LoadBalancer, io.grpc.BindableService {
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.grpclb.LoadBalanceRequest> balanceLoad(
io.grpc.stub.StreamObserver<io.grpc.grpclb.LoadBalanceResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_BALANCE_LOAD, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return LoadBalancerGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_BALANCE_LOAD,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.grpclb.LoadBalanceRequest,
io.grpc.grpclb.LoadBalanceResponse>(
this, METHODID_BALANCE_LOAD)))
.build();
}
}
/**
*/
@java.lang.Deprecated public static interface LoadBalancerBlockingClient {
}
/**
*/
@java.lang.Deprecated public static interface LoadBalancerFutureClient {
}
public static class LoadBalancerStub extends io.grpc.stub.AbstractStub<LoadBalancerStub>
implements LoadBalancer {
public static class LoadBalancerStub extends io.grpc.stub.AbstractStub<LoadBalancerStub> {
private LoadBalancerStub(io.grpc.Channel channel) {
super(channel);
}
@ -114,7 +105,11 @@ public class LoadBalancerGrpc {
return new LoadBalancerStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Bidirectional rpc to get a list of servers.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.grpclb.LoadBalanceRequest> balanceLoad(
io.grpc.stub.StreamObserver<io.grpc.grpclb.LoadBalanceResponse> responseObserver) {
return asyncBidiStreamingCall(
@ -122,8 +117,9 @@ public class LoadBalancerGrpc {
}
}
public static class LoadBalancerBlockingStub extends io.grpc.stub.AbstractStub<LoadBalancerBlockingStub>
implements LoadBalancerBlockingClient {
/**
*/
public static class LoadBalancerBlockingStub extends io.grpc.stub.AbstractStub<LoadBalancerBlockingStub> {
private LoadBalancerBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -140,8 +136,9 @@ public class LoadBalancerGrpc {
}
}
public static class LoadBalancerFutureStub extends io.grpc.stub.AbstractStub<LoadBalancerFutureStub>
implements LoadBalancerFutureClient {
/**
*/
public static class LoadBalancerFutureStub extends io.grpc.stub.AbstractStub<LoadBalancerFutureStub> {
private LoadBalancerFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -158,8 +155,6 @@ public class LoadBalancerGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractLoadBalancer extends LoadBalancerImplBase {}
private static final int METHODID_BALANCE_LOAD = 0;
private static class MethodHandlers<Req, Resp> implements
@ -167,10 +162,10 @@ public class LoadBalancerGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final LoadBalancer serviceImpl;
private final LoadBalancerImplBase serviceImpl;
private final int methodId;
public MethodHandlers(LoadBalancer serviceImpl, int methodId) {
public MethodHandlers(LoadBalancerImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -203,16 +198,4 @@ public class LoadBalancerGrpc {
METHOD_BALANCE_LOAD);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final LoadBalancer serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_BALANCE_LOAD,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.grpclb.LoadBalanceRequest,
io.grpc.grpclb.LoadBalanceResponse>(
serviceImpl, METHODID_BALANCE_LOAD)))
.build();
}
}

View File

@ -71,7 +71,7 @@ public class MetricsServiceGrpc {
/**
*/
@java.lang.Deprecated public static interface MetricsService {
public static abstract class MetricsServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
@ -80,73 +80,43 @@ public class MetricsServiceGrpc {
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_GET_ALL_GAUGES, responseObserver);
}
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class MetricsServiceImplBase implements MetricsService, io.grpc.BindableService {
@java.lang.Override
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_GET_ALL_GAUGES, responseObserver);
}
@java.lang.Override
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_GET_GAUGE, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return MetricsServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_GET_ALL_GAUGES,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_ALL_GAUGES)))
.addMethod(
METHOD_GET_GAUGE,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_GAUGE)))
.build();
}
}
/**
*/
@java.lang.Deprecated public static interface MetricsServiceBlockingClient {
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
io.grpc.testing.integration.Metrics.EmptyMessage request);
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request);
}
/**
*/
@java.lang.Deprecated public static interface MetricsServiceFutureClient {
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
io.grpc.testing.integration.Metrics.GaugeRequest request);
}
public static class MetricsServiceStub extends io.grpc.stub.AbstractStub<MetricsServiceStub>
implements MetricsService {
public static class MetricsServiceStub extends io.grpc.stub.AbstractStub<MetricsServiceStub> {
private MetricsServiceStub(io.grpc.Channel channel) {
super(channel);
}
@ -162,14 +132,23 @@ public class MetricsServiceGrpc {
return new MetricsServiceStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(METHOD_GET_ALL_GAUGES, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnaryCall(
@ -177,8 +156,9 @@ public class MetricsServiceGrpc {
}
}
public static class MetricsServiceBlockingStub extends io.grpc.stub.AbstractStub<MetricsServiceBlockingStub>
implements MetricsServiceBlockingClient {
/**
*/
public static class MetricsServiceBlockingStub extends io.grpc.stub.AbstractStub<MetricsServiceBlockingStub> {
private MetricsServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -194,22 +174,32 @@ public class MetricsServiceGrpc {
return new MetricsServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
io.grpc.testing.integration.Metrics.EmptyMessage request) {
return blockingServerStreamingCall(
getChannel(), METHOD_GET_ALL_GAUGES, getCallOptions(), request);
}
@java.lang.Override
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_GET_GAUGE, getCallOptions(), request);
}
}
public static class MetricsServiceFutureStub extends io.grpc.stub.AbstractStub<MetricsServiceFutureStub>
implements MetricsServiceFutureClient {
/**
*/
public static class MetricsServiceFutureStub extends io.grpc.stub.AbstractStub<MetricsServiceFutureStub> {
private MetricsServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -225,7 +215,11 @@ public class MetricsServiceGrpc {
return new MetricsServiceFutureStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
io.grpc.testing.integration.Metrics.GaugeRequest request) {
return futureUnaryCall(
@ -233,8 +227,6 @@ public class MetricsServiceGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractMetricsService extends MetricsServiceImplBase {}
private static final int METHODID_GET_ALL_GAUGES = 0;
private static final int METHODID_GET_GAUGE = 1;
@ -243,10 +235,10 @@ public class MetricsServiceGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final MetricsService serviceImpl;
private final MetricsServiceImplBase serviceImpl;
private final int methodId;
public MethodHandlers(MetricsService serviceImpl, int methodId) {
public MethodHandlers(MetricsServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -285,23 +277,4 @@ public class MetricsServiceGrpc {
METHOD_GET_GAUGE);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final MetricsService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_GET_ALL_GAUGES,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
serviceImpl, METHODID_GET_ALL_GAUGES)))
.addMethod(
METHOD_GET_GAUGE,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
serviceImpl, METHODID_GET_GAUGE)))
.build();
}
}

View File

@ -77,36 +77,39 @@ public class ReconnectServiceGrpc {
* A service used to control reconnect server.
* </pre>
*/
@java.lang.Deprecated public static interface ReconnectService {
public static abstract class ReconnectServiceImplBase implements io.grpc.BindableService {
/**
*/
public void start(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver);
/**
*/
public void stop(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class ReconnectServiceImplBase implements ReconnectService, io.grpc.BindableService {
@java.lang.Override
public void start(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_START, responseObserver);
}
@java.lang.Override
/**
*/
public void stop(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STOP, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return ReconnectServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_START,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
com.google.protobuf.EmptyProtos.Empty>(
this, METHODID_START)))
.addMethod(
METHOD_STOP,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo>(
this, METHODID_STOP)))
.build();
}
}
@ -115,37 +118,7 @@ public class ReconnectServiceGrpc {
* A service used to control reconnect server.
* </pre>
*/
@java.lang.Deprecated public static interface ReconnectServiceBlockingClient {
/**
*/
public com.google.protobuf.EmptyProtos.Empty start(com.google.protobuf.EmptyProtos.Empty request);
/**
*/
public io.grpc.testing.integration.Messages.ReconnectInfo stop(com.google.protobuf.EmptyProtos.Empty request);
}
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
@java.lang.Deprecated public static interface ReconnectServiceFutureClient {
/**
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> start(
com.google.protobuf.EmptyProtos.Empty request);
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.ReconnectInfo> stop(
com.google.protobuf.EmptyProtos.Empty request);
}
public static class ReconnectServiceStub extends io.grpc.stub.AbstractStub<ReconnectServiceStub>
implements ReconnectService {
public static class ReconnectServiceStub extends io.grpc.stub.AbstractStub<ReconnectServiceStub> {
private ReconnectServiceStub(io.grpc.Channel channel) {
super(channel);
}
@ -161,14 +134,16 @@ public class ReconnectServiceGrpc {
return new ReconnectServiceStub(channel, callOptions);
}
@java.lang.Override
/**
*/
public void start(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_START, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
*/
public void stop(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
asyncUnaryCall(
@ -176,8 +151,12 @@ public class ReconnectServiceGrpc {
}
}
public static class ReconnectServiceBlockingStub extends io.grpc.stub.AbstractStub<ReconnectServiceBlockingStub>
implements ReconnectServiceBlockingClient {
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static class ReconnectServiceBlockingStub extends io.grpc.stub.AbstractStub<ReconnectServiceBlockingStub> {
private ReconnectServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -193,21 +172,27 @@ public class ReconnectServiceGrpc {
return new ReconnectServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
*/
public com.google.protobuf.EmptyProtos.Empty start(com.google.protobuf.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), METHOD_START, getCallOptions(), request);
}
@java.lang.Override
/**
*/
public io.grpc.testing.integration.Messages.ReconnectInfo stop(com.google.protobuf.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), METHOD_STOP, getCallOptions(), request);
}
}
public static class ReconnectServiceFutureStub extends io.grpc.stub.AbstractStub<ReconnectServiceFutureStub>
implements ReconnectServiceFutureClient {
/**
* <pre>
* A service used to control reconnect server.
* </pre>
*/
public static class ReconnectServiceFutureStub extends io.grpc.stub.AbstractStub<ReconnectServiceFutureStub> {
private ReconnectServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -223,14 +208,16 @@ public class ReconnectServiceGrpc {
return new ReconnectServiceFutureStub(channel, callOptions);
}
@java.lang.Override
/**
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> start(
com.google.protobuf.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(METHOD_START, getCallOptions()), request);
}
@java.lang.Override
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.ReconnectInfo> stop(
com.google.protobuf.EmptyProtos.Empty request) {
return futureUnaryCall(
@ -238,8 +225,6 @@ public class ReconnectServiceGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractReconnectService extends ReconnectServiceImplBase {}
private static final int METHODID_START = 0;
private static final int METHODID_STOP = 1;
@ -248,10 +233,10 @@ public class ReconnectServiceGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final ReconnectService serviceImpl;
private final ReconnectServiceImplBase serviceImpl;
private final int methodId;
public MethodHandlers(ReconnectService serviceImpl, int methodId) {
public MethodHandlers(ReconnectServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -290,23 +275,4 @@ public class ReconnectServiceGrpc {
METHOD_STOP);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final ReconnectService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_START,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
com.google.protobuf.EmptyProtos.Empty>(
serviceImpl, METHODID_START)))
.addMethod(
METHOD_STOP,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
io.grpc.testing.integration.Messages.ReconnectInfo>(
serviceImpl, METHODID_STOP)))
.build();
}
}

View File

@ -115,7 +115,7 @@ public class TestServiceGrpc {
* performance with various types of payload.
* </pre>
*/
@java.lang.Deprecated public static interface TestService {
public static abstract class TestServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
@ -123,7 +123,9 @@ public class TestServiceGrpc {
* </pre>
*/
public void emptyCall(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver);
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_EMPTY_CALL, responseObserver);
}
/**
* <pre>
@ -131,7 +133,9 @@ public class TestServiceGrpc {
* </pre>
*/
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
/**
* <pre>
@ -140,7 +144,9 @@ public class TestServiceGrpc {
* </pre>
*/
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
/**
* <pre>
@ -149,7 +155,9 @@ public class TestServiceGrpc {
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
/**
* <pre>
@ -159,7 +167,9 @@ public class TestServiceGrpc {
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_DUPLEX_CALL, responseObserver);
}
/**
* <pre>
@ -169,51 +179,56 @@ public class TestServiceGrpc {
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class TestServiceImplBase implements TestService, io.grpc.BindableService {
@java.lang.Override
public void emptyCall(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_EMPTY_CALL, responseObserver);
}
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
}
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_FULL_DUPLEX_CALL, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_HALF_DUPLEX_CALL, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return TestServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_EMPTY_CALL,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
com.google.protobuf.EmptyProtos.Empty>(
this, METHODID_EMPTY_CALL)))
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse>(
this, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse>(
this, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_DUPLEX_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_FULL_DUPLEX_CALL)))
.addMethod(
METHOD_HALF_DUPLEX_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
this, METHODID_HALF_DUPLEX_CALL)))
.build();
}
}
@ -223,59 +238,7 @@ public class TestServiceGrpc {
* performance with various types of payload.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceBlockingClient {
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public com.google.protobuf.EmptyProtos.Empty emptyCall(com.google.protobuf.EmptyProtos.Empty request);
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request);
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest request);
}
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
@java.lang.Deprecated public static interface TestServiceFutureClient {
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> emptyCall(
com.google.protobuf.EmptyProtos.Empty request);
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> unaryCall(
io.grpc.testing.integration.Messages.SimpleRequest request);
}
public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
implements TestService {
public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> {
private TestServiceStub(io.grpc.Channel channel) {
super(channel);
}
@ -291,42 +254,73 @@ public class TestServiceGrpc {
return new TestServiceStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public void emptyCall(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_EMPTY_CALL, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.SimpleResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
}
@java.lang.Override
/**
* <pre>
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
}
@java.lang.Override
/**
* <pre>
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(METHOD_FULL_DUPLEX_CALL, getCallOptions()), responseObserver);
}
@java.lang.Override
/**
* <pre>
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
@ -334,8 +328,13 @@ public class TestServiceGrpc {
}
}
public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
implements TestServiceBlockingClient {
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> {
private TestServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -351,19 +350,32 @@ public class TestServiceGrpc {
return new TestServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public com.google.protobuf.EmptyProtos.Empty emptyCall(com.google.protobuf.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), METHOD_EMPTY_CALL, getCallOptions(), request);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
}
@java.lang.Override
/**
* <pre>
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Messages.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Messages.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
@ -371,8 +383,13 @@ public class TestServiceGrpc {
}
}
public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
implements TestServiceFutureClient {
/**
* <pre>
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
* </pre>
*/
public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> {
private TestServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -388,14 +405,22 @@ public class TestServiceGrpc {
return new TestServiceFutureStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* One empty request followed by one empty response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> emptyCall(
com.google.protobuf.EmptyProtos.Empty request) {
return futureUnaryCall(
getChannel().newCall(METHOD_EMPTY_CALL, getCallOptions()), request);
}
@java.lang.Override
/**
* <pre>
* One request followed by one response.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.SimpleResponse> unaryCall(
io.grpc.testing.integration.Messages.SimpleRequest request) {
return futureUnaryCall(
@ -403,8 +428,6 @@ public class TestServiceGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
private static final int METHODID_EMPTY_CALL = 0;
private static final int METHODID_UNARY_CALL = 1;
private static final int METHODID_STREAMING_OUTPUT_CALL = 2;
@ -417,10 +440,10 @@ public class TestServiceGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final TestService serviceImpl;
private final TestServiceImplBase serviceImpl;
private final int methodId;
public MethodHandlers(TestService serviceImpl, int methodId) {
public MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -476,51 +499,4 @@ public class TestServiceGrpc {
METHOD_HALF_DUPLEX_CALL);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_EMPTY_CALL,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
com.google.protobuf.EmptyProtos.Empty>(
serviceImpl, METHODID_EMPTY_CALL)))
.addMethod(
METHOD_UNARY_CALL,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.SimpleRequest,
io.grpc.testing.integration.Messages.SimpleResponse>(
serviceImpl, METHODID_UNARY_CALL)))
.addMethod(
METHOD_STREAMING_OUTPUT_CALL,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
.addMethod(
METHOD_STREAMING_INPUT_CALL,
asyncClientStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingInputCallRequest,
io.grpc.testing.integration.Messages.StreamingInputCallResponse>(
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
.addMethod(
METHOD_FULL_DUPLEX_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
serviceImpl, METHODID_FULL_DUPLEX_CALL)))
.addMethod(
METHOD_HALF_DUPLEX_CALL,
asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.StreamingOutputCallRequest,
io.grpc.testing.integration.Messages.StreamingOutputCallResponse>(
serviceImpl, METHODID_HALF_DUPLEX_CALL)))
.build();
}
}

View File

@ -70,28 +70,28 @@ public class UnimplementedServiceGrpc {
* that case.
* </pre>
*/
@java.lang.Deprecated public static interface UnimplementedService {
public static abstract class UnimplementedServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public void unimplementedCall(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class UnimplementedServiceImplBase implements UnimplementedService, io.grpc.BindableService {
@java.lang.Override
public void unimplementedCall(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_UNIMPLEMENTED_CALL, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return UnimplementedServiceGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNIMPLEMENTED_CALL,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
com.google.protobuf.EmptyProtos.Empty>(
this, METHODID_UNIMPLEMENTED_CALL)))
.build();
}
}
@ -101,35 +101,7 @@ public class UnimplementedServiceGrpc {
* that case.
* </pre>
*/
@java.lang.Deprecated public static interface UnimplementedServiceBlockingClient {
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public com.google.protobuf.EmptyProtos.Empty unimplementedCall(com.google.protobuf.EmptyProtos.Empty request);
}
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
@java.lang.Deprecated public static interface UnimplementedServiceFutureClient {
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> unimplementedCall(
com.google.protobuf.EmptyProtos.Empty request);
}
public static class UnimplementedServiceStub extends io.grpc.stub.AbstractStub<UnimplementedServiceStub>
implements UnimplementedService {
public static class UnimplementedServiceStub extends io.grpc.stub.AbstractStub<UnimplementedServiceStub> {
private UnimplementedServiceStub(io.grpc.Channel channel) {
super(channel);
}
@ -145,7 +117,11 @@ public class UnimplementedServiceGrpc {
return new UnimplementedServiceStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public void unimplementedCall(com.google.protobuf.EmptyProtos.Empty request,
io.grpc.stub.StreamObserver<com.google.protobuf.EmptyProtos.Empty> responseObserver) {
asyncUnaryCall(
@ -153,8 +129,13 @@ public class UnimplementedServiceGrpc {
}
}
public static class UnimplementedServiceBlockingStub extends io.grpc.stub.AbstractStub<UnimplementedServiceBlockingStub>
implements UnimplementedServiceBlockingClient {
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static class UnimplementedServiceBlockingStub extends io.grpc.stub.AbstractStub<UnimplementedServiceBlockingStub> {
private UnimplementedServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -170,15 +151,24 @@ public class UnimplementedServiceGrpc {
return new UnimplementedServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public com.google.protobuf.EmptyProtos.Empty unimplementedCall(com.google.protobuf.EmptyProtos.Empty request) {
return blockingUnaryCall(
getChannel(), METHOD_UNIMPLEMENTED_CALL, getCallOptions(), request);
}
}
public static class UnimplementedServiceFutureStub extends io.grpc.stub.AbstractStub<UnimplementedServiceFutureStub>
implements UnimplementedServiceFutureClient {
/**
* <pre>
* A simple service NOT implemented at servers so clients can test for
* that case.
* </pre>
*/
public static class UnimplementedServiceFutureStub extends io.grpc.stub.AbstractStub<UnimplementedServiceFutureStub> {
private UnimplementedServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -194,7 +184,11 @@ public class UnimplementedServiceGrpc {
return new UnimplementedServiceFutureStub(channel, callOptions);
}
@java.lang.Override
/**
* <pre>
* A call that no server should implement
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.EmptyProtos.Empty> unimplementedCall(
com.google.protobuf.EmptyProtos.Empty request) {
return futureUnaryCall(
@ -202,8 +196,6 @@ public class UnimplementedServiceGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractUnimplementedService extends UnimplementedServiceImplBase {}
private static final int METHODID_UNIMPLEMENTED_CALL = 0;
private static class MethodHandlers<Req, Resp> implements
@ -211,10 +203,10 @@ public class UnimplementedServiceGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final UnimplementedService serviceImpl;
private final UnimplementedServiceImplBase serviceImpl;
private final int methodId;
public MethodHandlers(UnimplementedService serviceImpl, int methodId) {
public MethodHandlers(UnimplementedServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -248,16 +240,4 @@ public class UnimplementedServiceGrpc {
METHOD_UNIMPLEMENTED_CALL);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final UnimplementedService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_UNIMPLEMENTED_CALL,
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.EmptyProtos.Empty,
com.google.protobuf.EmptyProtos.Empty>(
serviceImpl, METHODID_UNIMPLEMENTED_CALL)))
.build();
}
}

View File

@ -62,49 +62,31 @@ public class HealthGrpc {
/**
*/
@java.lang.Deprecated public static interface Health {
public static abstract class HealthImplBase implements io.grpc.BindableService {
/**
*/
public void check(io.grpc.health.v1.HealthCheckRequest request,
io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver);
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
public static abstract class HealthImplBase implements Health, io.grpc.BindableService {
@java.lang.Override
public void check(io.grpc.health.v1.HealthCheckRequest request,
io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_CHECK, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return HealthGrpc.bindService(this);
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_CHECK,
asyncUnaryCall(
new MethodHandlers<
io.grpc.health.v1.HealthCheckRequest,
io.grpc.health.v1.HealthCheckResponse>(
this, METHODID_CHECK)))
.build();
}
}
/**
*/
@java.lang.Deprecated public static interface HealthBlockingClient {
/**
*/
public io.grpc.health.v1.HealthCheckResponse check(io.grpc.health.v1.HealthCheckRequest request);
}
/**
*/
@java.lang.Deprecated public static interface HealthFutureClient {
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.health.v1.HealthCheckResponse> check(
io.grpc.health.v1.HealthCheckRequest request);
}
public static class HealthStub extends io.grpc.stub.AbstractStub<HealthStub>
implements Health {
public static class HealthStub extends io.grpc.stub.AbstractStub<HealthStub> {
private HealthStub(io.grpc.Channel channel) {
super(channel);
}
@ -120,7 +102,8 @@ public class HealthGrpc {
return new HealthStub(channel, callOptions);
}
@java.lang.Override
/**
*/
public void check(io.grpc.health.v1.HealthCheckRequest request,
io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver) {
asyncUnaryCall(
@ -128,8 +111,9 @@ public class HealthGrpc {
}
}
public static class HealthBlockingStub extends io.grpc.stub.AbstractStub<HealthBlockingStub>
implements HealthBlockingClient {
/**
*/
public static class HealthBlockingStub extends io.grpc.stub.AbstractStub<HealthBlockingStub> {
private HealthBlockingStub(io.grpc.Channel channel) {
super(channel);
}
@ -145,15 +129,17 @@ public class HealthGrpc {
return new HealthBlockingStub(channel, callOptions);
}
@java.lang.Override
/**
*/
public io.grpc.health.v1.HealthCheckResponse check(io.grpc.health.v1.HealthCheckRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_CHECK, getCallOptions(), request);
}
}
public static class HealthFutureStub extends io.grpc.stub.AbstractStub<HealthFutureStub>
implements HealthFutureClient {
/**
*/
public static class HealthFutureStub extends io.grpc.stub.AbstractStub<HealthFutureStub> {
private HealthFutureStub(io.grpc.Channel channel) {
super(channel);
}
@ -169,7 +155,8 @@ public class HealthGrpc {
return new HealthFutureStub(channel, callOptions);
}
@java.lang.Override
/**
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.health.v1.HealthCheckResponse> check(
io.grpc.health.v1.HealthCheckRequest request) {
return futureUnaryCall(
@ -177,8 +164,6 @@ public class HealthGrpc {
}
}
@java.lang.Deprecated public static abstract class AbstractHealth extends HealthImplBase {}
private static final int METHODID_CHECK = 0;
private static class MethodHandlers<Req, Resp> implements
@ -186,10 +171,10 @@ public class HealthGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final Health serviceImpl;
private final HealthImplBase serviceImpl;
private final int methodId;
public MethodHandlers(Health serviceImpl, int methodId) {
public MethodHandlers(HealthImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -223,16 +208,4 @@ public class HealthGrpc {
METHOD_CHECK);
}
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
final Health serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_CHECK,
asyncUnaryCall(
new MethodHandlers<
io.grpc.health.v1.HealthCheckRequest,
io.grpc.health.v1.HealthCheckResponse>(
serviceImpl, METHODID_CHECK)))
.build();
}
}