diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java index 415838f814..c3fe39a184 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java @@ -71,7 +71,7 @@ public class BenchmarkServiceGrpc { /** */ - @java.lang.Deprecated public static interface BenchmarkService { + public static abstract class BenchmarkServiceImplBase implements io.grpc.BindableService { /** *
@@ -79,68 +79,45 @@ public class BenchmarkServiceGrpc {
      * The server returns the client payload as-is.
      * 
*/ - public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request, - io.grpc.stub.StreamObserver responseObserver); - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public io.grpc.stub.StreamObserver streamingCall( - io.grpc.stub.StreamObserver 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 responseObserver) { asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ public io.grpc.stub.StreamObserver streamingCall( io.grpc.stub.StreamObserver 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 { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public io.grpc.benchmarks.proto.Messages.SimpleResponse unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request); - } - - /** - */ - @java.lang.Deprecated public static interface BenchmarkServiceFutureClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture unaryCall( - io.grpc.benchmarks.proto.Messages.SimpleRequest request); - } - - public static class BenchmarkServiceStub extends io.grpc.stub.AbstractStub - implements BenchmarkService { + public static class BenchmarkServiceStub extends io.grpc.stub.AbstractStub { private BenchmarkServiceStub(io.grpc.Channel channel) { super(channel); } @@ -156,14 +133,24 @@ public class BenchmarkServiceGrpc { return new BenchmarkServiceStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ public io.grpc.stub.StreamObserver streamingCall( io.grpc.stub.StreamObserver responseObserver) { return asyncBidiStreamingCall( @@ -171,8 +158,9 @@ public class BenchmarkServiceGrpc { } } - public static class BenchmarkServiceBlockingStub extends io.grpc.stub.AbstractStub - implements BenchmarkServiceBlockingClient { + /** + */ + public static class BenchmarkServiceBlockingStub extends io.grpc.stub.AbstractStub { private BenchmarkServiceBlockingStub(io.grpc.Channel channel) { super(channel); } @@ -188,15 +176,21 @@ public class BenchmarkServiceGrpc { return new BenchmarkServiceBlockingStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ 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 - implements BenchmarkServiceFutureClient { + /** + */ + public static class BenchmarkServiceFutureStub extends io.grpc.stub.AbstractStub { private BenchmarkServiceFutureStub(io.grpc.Channel channel) { super(channel); } @@ -212,7 +206,12 @@ public class BenchmarkServiceGrpc { return new BenchmarkServiceFutureStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture 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, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java index 5572d1d451..072ef5d34a 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java @@ -89,7 +89,7 @@ public class WorkerServiceGrpc { /** */ - @java.lang.Deprecated public static interface WorkerService { + public static abstract class WorkerServiceImplBase implements io.grpc.BindableService { /** *
@@ -102,7 +102,9 @@ public class WorkerServiceGrpc {
      * 
*/ public io.grpc.stub.StreamObserver runServer( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_RUN_SERVER, responseObserver); + } /** *
@@ -115,7 +117,9 @@ public class WorkerServiceGrpc {
      * 
*/ public io.grpc.stub.StreamObserver runClient( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_RUN_CLIENT, responseObserver); + } /** *
@@ -123,91 +127,57 @@ public class WorkerServiceGrpc {
      * 
*/ public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_CORE_COUNT, responseObserver); + } /** *
      * Quit this worker
      * 
*/ - public void quitWorker(io.grpc.benchmarks.proto.Control.Void request, - io.grpc.stub.StreamObserver 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 runServer( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_RUN_SERVER, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver runClient( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_RUN_CLIENT, responseObserver); - } - - @java.lang.Override - public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(METHOD_CORE_COUNT, responseObserver); - } - - @java.lang.Override public void quitWorker(io.grpc.benchmarks.proto.Control.Void request, io.grpc.stub.StreamObserver 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 { - - /** - *
-     * Just return the core count - unary call
-     * 
- */ - public io.grpc.benchmarks.proto.Control.CoreResponse coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request); - - /** - *
-     * Quit this worker
-     * 
- */ - public io.grpc.benchmarks.proto.Control.Void quitWorker(io.grpc.benchmarks.proto.Control.Void request); - } - - /** - */ - @java.lang.Deprecated public static interface WorkerServiceFutureClient { - - /** - *
-     * Just return the core count - unary call
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture coreCount( - io.grpc.benchmarks.proto.Control.CoreRequest request); - - /** - *
-     * Quit this worker
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture quitWorker( - io.grpc.benchmarks.proto.Control.Void request); - } - - public static class WorkerServiceStub extends io.grpc.stub.AbstractStub - implements WorkerService { + public static class WorkerServiceStub extends io.grpc.stub.AbstractStub { private WorkerServiceStub(io.grpc.Channel channel) { super(channel); } @@ -223,28 +193,54 @@ public class WorkerServiceGrpc { return new WorkerServiceStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * 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.
+     * 
+ */ public io.grpc.stub.StreamObserver runServer( io.grpc.stub.StreamObserver responseObserver) { return asyncBidiStreamingCall( getChannel().newCall(METHOD_RUN_SERVER, getCallOptions()), responseObserver); } - @java.lang.Override + /** + *
+     * 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.
+     * 
+ */ public io.grpc.stub.StreamObserver runClient( io.grpc.stub.StreamObserver responseObserver) { return asyncBidiStreamingCall( getChannel().newCall(METHOD_RUN_CLIENT, getCallOptions()), responseObserver); } - @java.lang.Override + /** + *
+     * Just return the core count - unary call
+     * 
+ */ public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( getChannel().newCall(METHOD_CORE_COUNT, getCallOptions()), request, responseObserver); } - @java.lang.Override + /** + *
+     * Quit this worker
+     * 
+ */ public void quitWorker(io.grpc.benchmarks.proto.Control.Void request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( @@ -252,8 +248,9 @@ public class WorkerServiceGrpc { } } - public static class WorkerServiceBlockingStub extends io.grpc.stub.AbstractStub - implements WorkerServiceBlockingClient { + /** + */ + public static class WorkerServiceBlockingStub extends io.grpc.stub.AbstractStub { private WorkerServiceBlockingStub(io.grpc.Channel channel) { super(channel); } @@ -269,21 +266,30 @@ public class WorkerServiceGrpc { return new WorkerServiceBlockingStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * Just return the core count - unary call
+     * 
+ */ 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 + /** + *
+     * Quit this worker
+     * 
+ */ 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 - implements WorkerServiceFutureClient { + /** + */ + public static class WorkerServiceFutureStub extends io.grpc.stub.AbstractStub { private WorkerServiceFutureStub(io.grpc.Channel channel) { super(channel); } @@ -299,14 +305,22 @@ public class WorkerServiceGrpc { return new WorkerServiceFutureStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * Just return the core count - unary call
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture coreCount( io.grpc.benchmarks.proto.Control.CoreRequest request) { return futureUnaryCall( getChannel().newCall(METHOD_CORE_COUNT, getCallOptions()), request); } - @java.lang.Override + /** + *
+     * Quit this worker
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture 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, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/build.gradle b/build.gradle index 5fb0cf36eb..a6fce8b591 100644 --- a/build.gradle +++ b/build.gradle @@ -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' + } } } } diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp index a992c34b15..73cd6e9ad8 100644 --- a/compiler/src/java_plugin/cpp/java_generator.cpp +++ b/compiler/src/java_plugin/cpp/java_generator.cpp @@ -427,110 +427,137 @@ enum CallType { FUTURE_CALL = 2 }; +static void PrintBindServiceMethodBody(const ServiceDescriptor* service, + map* vars, + Printer* p, + bool generate_nano); + +static void PrintDeprecatedDocComment(const ServiceDescriptor* service, + map* 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" + " *
    \n" + " *
  • replace {@code extends/implements $service_name$}" + " with {@code extends $service_name$ImplBase} for server side;
  • \n" + " *
  • replace {@code $service_name$} with {@code $service_name$Stub} for client side;" + "
  • \n" + " *
  • replace usage of {@code $service_name$} with {@code $service_name$ImplBase};" + "
  • \n" + " *
  • replace usage of {@code Abstract$service_name$}" + " with {@link $service_name$ImplBase};
  • \n" + " *
  • replace" + " {@code serverBuilder.addService($service_class_name$.bindService(serviceImpl))}\n" + " * with {@code serverBuilder.addService(serviceImpl)};
  • \n" + " *
  • if you are mocking stubs using mockito, please do not mock them.\n" + " * See the documentation on testing with gRPC-java;
  • \n" + " *
  • replace {@code $service_name$BlockingClient}" + " with {@link $service_name$BlockingStub};
  • \n" + " *
  • replace {@code $service_name$FutureClient}" + " with {@link $service_name$FutureStub}.
  • \n" + " *
\n" + " */\n"); +} + // Prints a client interface or implementation class, or a server interface. static void PrintStub( const ServiceDescriptor* service, map* 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* 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 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 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* 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* 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 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) { diff --git a/compiler/src/java_plugin/cpp/java_generator.h b/compiler/src/java_plugin/cpp/java_generator.h index 29c6fd9529..6754249ec3 100644 --- a/compiler/src/java_plugin/cpp/java_generator.h +++ b/compiler/src/java_plugin/cpp/java_generator.h @@ -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 diff --git a/compiler/src/java_plugin/cpp/java_plugin.cpp b/compiler/src/java_plugin/cpp/java_plugin.cpp index 5b4b19094e..9765fa70a9 100644 --- a/compiler/src/java_plugin/cpp/java_plugin.cpp +++ b/compiler/src/java_plugin/cpp/java_plugin.cpp @@ -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 output( context->Open(filename)); - java_grpc_generator::GenerateService(service, output.get(), flavor); + java_grpc_generator::GenerateService(service, output.get(), flavor, enable_deprecated); } return true; } diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt index 9be7964671..57747151e6 100644 --- a/compiler/src/test/golden/TestService.java.txt +++ b/compiler/src/test/golden/TestService.java.txt @@ -104,7 +104,7 @@ public class TestServiceGrpc { * Test service that supports all call types. * */ - @java.lang.Deprecated public static interface TestService { + public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService { /** *
@@ -112,8 +112,11 @@ public class TestServiceGrpc {
      * The server returns the client payload as-is.
      * 
*/ + @java.lang.Override public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); + } /** *
@@ -121,8 +124,11 @@ public class TestServiceGrpc {
      * The server returns the payload with client desired type and sizes.
      * 
*/ + @java.lang.Override public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); + } /** *
@@ -130,8 +136,11 @@ public class TestServiceGrpc {
      * The server returns the aggregated size of client payload as the result.
      * 
*/ + @java.lang.Override public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); + } /** *
@@ -140,8 +149,11 @@ public class TestServiceGrpc {
      * demonstrates the idea of full bidirectionality.
      * 
*/ + @java.lang.Override public io.grpc.stub.StreamObserver fullBidiCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); + } /** *
@@ -151,37 +163,6 @@ public class TestServiceGrpc {
      * first request.
      * 
*/ - public io.grpc.stub.StreamObserver halfBidiCall( - io.grpc.stub.StreamObserver 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 responseObserver) { - asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); - } - - @java.lang.Override - public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver fullBidiCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); - } - @java.lang.Override public io.grpc.stub.StreamObserver halfBidiCall( io.grpc.stub.StreamObserver 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. * */ - @java.lang.Deprecated public static interface TestServiceBlockingClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request); - - /** - *
-     * One request followed by a sequence of responses (streamed download).
-     * The server returns the payload with client desired type and sizes.
-     * 
- */ - public java.util.Iterator streamingOutputCall( - io.grpc.testing.integration.Test.StreamingOutputCallRequest request); - } - - /** - *
-   * Test service that supports all call types.
-   * 
- */ - @java.lang.Deprecated public static interface TestServiceFutureClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture unaryCall( - io.grpc.testing.integration.Test.SimpleRequest request); - } - public static class TestServiceStub extends io.grpc.stub.AbstractStub implements TestService { private TestServiceStub(io.grpc.Channel channel) { @@ -252,6 +232,12 @@ public class TestServiceGrpc { return new TestServiceStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @java.lang.Override public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, io.grpc.stub.StreamObserver responseObserver) { @@ -259,6 +245,12 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); } + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ @java.lang.Override public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, io.grpc.stub.StreamObserver responseObserver) { @@ -266,6 +258,12 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); } + /** + *
+     * A sequence of requests followed by one response (streamed upload).
+     * The server returns the aggregated size of client payload as the result.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver streamingInputCall( io.grpc.stub.StreamObserver responseObserver) { @@ -273,6 +271,13 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); } + /** + *
+     * 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.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver fullBidiCall( io.grpc.stub.StreamObserver responseObserver) { @@ -280,6 +285,14 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); } + /** + *
+     * 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.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver halfBidiCall( io.grpc.stub.StreamObserver responseObserver) { @@ -288,6 +301,11 @@ public class TestServiceGrpc { } } + /** + *
+   * Test service that supports all call types.
+   * 
+ */ public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub implements TestServiceBlockingClient { private TestServiceBlockingStub(io.grpc.Channel channel) { @@ -305,12 +323,24 @@ public class TestServiceGrpc { return new TestServiceBlockingStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @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); } + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ @java.lang.Override public java.util.Iterator streamingOutputCall( io.grpc.testing.integration.Test.StreamingOutputCallRequest request) { @@ -319,6 +349,11 @@ public class TestServiceGrpc { } } + /** + *
+   * Test service that supports all call types.
+   * 
+ */ public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub implements TestServiceFutureClient { private TestServiceFutureStub(io.grpc.Channel channel) { @@ -336,6 +371,12 @@ public class TestServiceGrpc { return new TestServiceFutureStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @java.lang.Override public com.google.common.util.concurrent.ListenableFuture 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @java.lang.Deprecated public static interface TestService { + + public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, + io.grpc.stub.StreamObserver responseObserver); + + public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver streamingInputCall( + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver fullBidiCall( + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver halfBidiCall( + io.grpc.stub.StreamObserver 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @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 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @java.lang.Deprecated public static interface TestServiceFutureClient { + + public com.google.common.util.concurrent.ListenableFuture 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ @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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @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(); - } } diff --git a/compiler/src/testLite/golden/TestService.java.txt b/compiler/src/testLite/golden/TestService.java.txt index b81fc9b914..7637f077b5 100644 --- a/compiler/src/testLite/golden/TestService.java.txt +++ b/compiler/src/testLite/golden/TestService.java.txt @@ -104,7 +104,7 @@ public class TestServiceGrpc { * Test service that supports all call types. * */ - @java.lang.Deprecated public static interface TestService { + public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService { /** *
@@ -112,8 +112,11 @@ public class TestServiceGrpc {
      * The server returns the client payload as-is.
      * 
*/ + @java.lang.Override public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); + } /** *
@@ -121,8 +124,11 @@ public class TestServiceGrpc {
      * The server returns the payload with client desired type and sizes.
      * 
*/ + @java.lang.Override public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); + } /** *
@@ -130,8 +136,11 @@ public class TestServiceGrpc {
      * The server returns the aggregated size of client payload as the result.
      * 
*/ + @java.lang.Override public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); + } /** *
@@ -140,8 +149,11 @@ public class TestServiceGrpc {
      * demonstrates the idea of full bidirectionality.
      * 
*/ + @java.lang.Override public io.grpc.stub.StreamObserver fullBidiCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); + } /** *
@@ -151,37 +163,6 @@ public class TestServiceGrpc {
      * first request.
      * 
*/ - public io.grpc.stub.StreamObserver halfBidiCall( - io.grpc.stub.StreamObserver 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 responseObserver) { - asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); - } - - @java.lang.Override - public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver fullBidiCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); - } - @java.lang.Override public io.grpc.stub.StreamObserver halfBidiCall( io.grpc.stub.StreamObserver 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. * */ - @java.lang.Deprecated public static interface TestServiceBlockingClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request); - - /** - *
-     * One request followed by a sequence of responses (streamed download).
-     * The server returns the payload with client desired type and sizes.
-     * 
- */ - public java.util.Iterator streamingOutputCall( - io.grpc.testing.integration.Test.StreamingOutputCallRequest request); - } - - /** - *
-   * Test service that supports all call types.
-   * 
- */ - @java.lang.Deprecated public static interface TestServiceFutureClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture unaryCall( - io.grpc.testing.integration.Test.SimpleRequest request); - } - public static class TestServiceStub extends io.grpc.stub.AbstractStub implements TestService { private TestServiceStub(io.grpc.Channel channel) { @@ -252,6 +232,12 @@ public class TestServiceGrpc { return new TestServiceStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @java.lang.Override public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, io.grpc.stub.StreamObserver responseObserver) { @@ -259,6 +245,12 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); } + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ @java.lang.Override public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, io.grpc.stub.StreamObserver responseObserver) { @@ -266,6 +258,12 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); } + /** + *
+     * A sequence of requests followed by one response (streamed upload).
+     * The server returns the aggregated size of client payload as the result.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver streamingInputCall( io.grpc.stub.StreamObserver responseObserver) { @@ -273,6 +271,13 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); } + /** + *
+     * 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.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver fullBidiCall( io.grpc.stub.StreamObserver responseObserver) { @@ -280,6 +285,14 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); } + /** + *
+     * 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.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver halfBidiCall( io.grpc.stub.StreamObserver responseObserver) { @@ -288,6 +301,11 @@ public class TestServiceGrpc { } } + /** + *
+   * Test service that supports all call types.
+   * 
+ */ public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub implements TestServiceBlockingClient { private TestServiceBlockingStub(io.grpc.Channel channel) { @@ -305,12 +323,24 @@ public class TestServiceGrpc { return new TestServiceBlockingStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @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); } + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ @java.lang.Override public java.util.Iterator streamingOutputCall( io.grpc.testing.integration.Test.StreamingOutputCallRequest request) { @@ -319,6 +349,11 @@ public class TestServiceGrpc { } } + /** + *
+   * Test service that supports all call types.
+   * 
+ */ public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub implements TestServiceFutureClient { private TestServiceFutureStub(io.grpc.Channel channel) { @@ -336,6 +371,12 @@ public class TestServiceGrpc { return new TestServiceFutureStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @java.lang.Override public com.google.common.util.concurrent.ListenableFuture 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @java.lang.Deprecated public static interface TestService { + + public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, + io.grpc.stub.StreamObserver responseObserver); + + public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver streamingInputCall( + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver fullBidiCall( + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver halfBidiCall( + io.grpc.stub.StreamObserver 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @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 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @java.lang.Deprecated public static interface TestServiceFutureClient { + + public com.google.common.util.concurrent.ListenableFuture 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ @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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @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(); - } } diff --git a/compiler/src/testNano/golden/TestService.java.txt b/compiler/src/testNano/golden/TestService.java.txt index 18455b916b..9c0ac11de8 100644 --- a/compiler/src/testNano/golden/TestService.java.txt +++ b/compiler/src/testNano/golden/TestService.java.txt @@ -182,7 +182,7 @@ public class TestServiceGrpc { * Test service that supports all call types. * */ - @java.lang.Deprecated public static interface TestService { + public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService { /** *
@@ -190,8 +190,11 @@ public class TestServiceGrpc {
      * The server returns the client payload as-is.
      * 
*/ + @java.lang.Override public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); + } /** *
@@ -199,8 +202,11 @@ public class TestServiceGrpc {
      * The server returns the payload with client desired type and sizes.
      * 
*/ + @java.lang.Override public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); + } /** *
@@ -208,8 +214,11 @@ public class TestServiceGrpc {
      * The server returns the aggregated size of client payload as the result.
      * 
*/ + @java.lang.Override public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); + } /** *
@@ -218,8 +227,11 @@ public class TestServiceGrpc {
      * demonstrates the idea of full bidirectionality.
      * 
*/ + @java.lang.Override public io.grpc.stub.StreamObserver fullBidiCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); + } /** *
@@ -229,37 +241,6 @@ public class TestServiceGrpc {
      * first request.
      * 
*/ - public io.grpc.stub.StreamObserver halfBidiCall( - io.grpc.stub.StreamObserver 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 responseObserver) { - asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); - } - - @java.lang.Override - public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver fullBidiCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); - } - @java.lang.Override public io.grpc.stub.StreamObserver halfBidiCall( io.grpc.stub.StreamObserver 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. * */ - @java.lang.Deprecated public static interface TestServiceBlockingClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request); - - /** - *
-     * One request followed by a sequence of responses (streamed download).
-     * The server returns the payload with client desired type and sizes.
-     * 
- */ - public java.util.Iterator streamingOutputCall( - io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request); - } - - /** - *
-   * Test service that supports all call types.
-   * 
- */ - @java.lang.Deprecated public static interface TestServiceFutureClient { - - /** - *
-     * One request followed by one response.
-     * The server returns the client payload as-is.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture unaryCall( - io.grpc.testing.integration.nano.Test.SimpleRequest request); - } - public static class TestServiceStub extends io.grpc.stub.AbstractStub implements TestService { private TestServiceStub(io.grpc.Channel channel) { @@ -330,6 +310,12 @@ public class TestServiceGrpc { return new TestServiceStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @java.lang.Override public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request, io.grpc.stub.StreamObserver responseObserver) { @@ -337,6 +323,12 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); } + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ @java.lang.Override public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request, io.grpc.stub.StreamObserver responseObserver) { @@ -344,6 +336,12 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); } + /** + *
+     * A sequence of requests followed by one response (streamed upload).
+     * The server returns the aggregated size of client payload as the result.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver streamingInputCall( io.grpc.stub.StreamObserver responseObserver) { @@ -351,6 +349,13 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); } + /** + *
+     * 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.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver fullBidiCall( io.grpc.stub.StreamObserver responseObserver) { @@ -358,6 +363,14 @@ public class TestServiceGrpc { getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); } + /** + *
+     * 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.
+     * 
+ */ @java.lang.Override public io.grpc.stub.StreamObserver halfBidiCall( io.grpc.stub.StreamObserver responseObserver) { @@ -366,6 +379,11 @@ public class TestServiceGrpc { } } + /** + *
+   * Test service that supports all call types.
+   * 
+ */ public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub implements TestServiceBlockingClient { private TestServiceBlockingStub(io.grpc.Channel channel) { @@ -383,12 +401,24 @@ public class TestServiceGrpc { return new TestServiceBlockingStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @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); } + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ @java.lang.Override public java.util.Iterator streamingOutputCall( io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) { @@ -397,6 +427,11 @@ public class TestServiceGrpc { } } + /** + *
+   * Test service that supports all call types.
+   * 
+ */ public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub implements TestServiceFutureClient { private TestServiceFutureStub(io.grpc.Channel channel) { @@ -414,6 +449,12 @@ public class TestServiceGrpc { return new TestServiceFutureStub(channel, callOptions); } + /** + *
+     * One request followed by one response.
+     * The server returns the client payload as-is.
+     * 
+ */ @java.lang.Override public com.google.common.util.concurrent.ListenableFuture 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @java.lang.Deprecated public static interface TestService { + + public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request, + io.grpc.stub.StreamObserver responseObserver); + + public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request, + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver streamingInputCall( + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver fullBidiCall( + io.grpc.stub.StreamObserver responseObserver); + + public io.grpc.stub.StreamObserver halfBidiCall( + io.grpc.stub.StreamObserver 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @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 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @java.lang.Deprecated public static interface TestServiceFutureClient { + + public com.google.common.util.concurrent.ListenableFuture 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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ @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: + *
    + *
  • replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;
  • + *
  • replace {@code TestService} with {@code TestServiceStub} for client side;
  • + *
  • replace usage of {@code TestService} with {@code TestServiceImplBase};
  • + *
  • replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};
  • + *
  • replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))} + * with {@code serverBuilder.addService(serviceImpl)};
  • + *
  • if you are mocking stubs using mockito, please do not mock them. + * See the documentation on testing with gRPC-java;
  • + *
  • replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};
  • + *
  • replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.
  • + *
+ */ + @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(); - } } diff --git a/examples/build.gradle b/examples/build.gradle index 4e6ffd031c..6f9f1f61c5 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -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' + } } } } diff --git a/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java b/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java index 553c05ff4d..444479fcc3 100644 --- a/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java +++ b/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java @@ -62,43 +62,34 @@ public class LoadBalancerGrpc { /** */ - @java.lang.Deprecated public static interface LoadBalancer { + public static abstract class LoadBalancerImplBase implements io.grpc.BindableService { /** *
      * Bidirectional rpc to get a list of servers.
      * 
*/ - public io.grpc.stub.StreamObserver balanceLoad( - io.grpc.stub.StreamObserver 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 balanceLoad( io.grpc.stub.StreamObserver 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 - implements LoadBalancer { + public static class LoadBalancerStub extends io.grpc.stub.AbstractStub { private LoadBalancerStub(io.grpc.Channel channel) { super(channel); } @@ -114,7 +105,11 @@ public class LoadBalancerGrpc { return new LoadBalancerStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * Bidirectional rpc to get a list of servers.
+     * 
+ */ public io.grpc.stub.StreamObserver balanceLoad( io.grpc.stub.StreamObserver responseObserver) { return asyncBidiStreamingCall( @@ -122,8 +117,9 @@ public class LoadBalancerGrpc { } } - public static class LoadBalancerBlockingStub extends io.grpc.stub.AbstractStub - implements LoadBalancerBlockingClient { + /** + */ + public static class LoadBalancerBlockingStub extends io.grpc.stub.AbstractStub { private LoadBalancerBlockingStub(io.grpc.Channel channel) { super(channel); } @@ -140,8 +136,9 @@ public class LoadBalancerGrpc { } } - public static class LoadBalancerFutureStub extends io.grpc.stub.AbstractStub - implements LoadBalancerFutureClient { + /** + */ + public static class LoadBalancerFutureStub extends io.grpc.stub.AbstractStub { 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 implements @@ -167,10 +162,10 @@ public class LoadBalancerGrpc { io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java index d771e65b89..7572df1b76 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java @@ -71,7 +71,7 @@ public class MetricsServiceGrpc { /** */ - @java.lang.Deprecated public static interface MetricsService { + public static abstract class MetricsServiceImplBase implements io.grpc.BindableService { /** *
@@ -80,73 +80,43 @@ public class MetricsServiceGrpc {
      * 
*/ public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_GET_ALL_GAUGES, responseObserver); + } /** *
      * Returns the value of one gauge
      * 
*/ - public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request, - io.grpc.stub.StreamObserver 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 responseObserver) { - asyncUnimplementedUnaryCall(METHOD_GET_ALL_GAUGES, responseObserver); - } - - @java.lang.Override public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request, io.grpc.stub.StreamObserver 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 { - - /** - *
-     * Returns the values of all the gauges that are currently being maintained by
-     * the service
-     * 
- */ - public java.util.Iterator getAllGauges( - io.grpc.testing.integration.Metrics.EmptyMessage request); - - /** - *
-     * Returns the value of one gauge
-     * 
- */ - public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request); - } - - /** - */ - @java.lang.Deprecated public static interface MetricsServiceFutureClient { - - /** - *
-     * Returns the value of one gauge
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture getGauge( - io.grpc.testing.integration.Metrics.GaugeRequest request); - } - - public static class MetricsServiceStub extends io.grpc.stub.AbstractStub - implements MetricsService { + public static class MetricsServiceStub extends io.grpc.stub.AbstractStub { private MetricsServiceStub(io.grpc.Channel channel) { super(channel); } @@ -162,14 +132,23 @@ public class MetricsServiceGrpc { return new MetricsServiceStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * Returns the values of all the gauges that are currently being maintained by
+     * the service
+     * 
+ */ public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request, io.grpc.stub.StreamObserver responseObserver) { asyncServerStreamingCall( getChannel().newCall(METHOD_GET_ALL_GAUGES, getCallOptions()), request, responseObserver); } - @java.lang.Override + /** + *
+     * Returns the value of one gauge
+     * 
+ */ public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( @@ -177,8 +156,9 @@ public class MetricsServiceGrpc { } } - public static class MetricsServiceBlockingStub extends io.grpc.stub.AbstractStub - implements MetricsServiceBlockingClient { + /** + */ + public static class MetricsServiceBlockingStub extends io.grpc.stub.AbstractStub { private MetricsServiceBlockingStub(io.grpc.Channel channel) { super(channel); } @@ -194,22 +174,32 @@ public class MetricsServiceGrpc { return new MetricsServiceBlockingStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * Returns the values of all the gauges that are currently being maintained by
+     * the service
+     * 
+ */ public java.util.Iterator getAllGauges( io.grpc.testing.integration.Metrics.EmptyMessage request) { return blockingServerStreamingCall( getChannel(), METHOD_GET_ALL_GAUGES, getCallOptions(), request); } - @java.lang.Override + /** + *
+     * Returns the value of one gauge
+     * 
+ */ 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 - implements MetricsServiceFutureClient { + /** + */ + public static class MetricsServiceFutureStub extends io.grpc.stub.AbstractStub { private MetricsServiceFutureStub(io.grpc.Channel channel) { super(channel); } @@ -225,7 +215,11 @@ public class MetricsServiceGrpc { return new MetricsServiceFutureStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * Returns the value of one gauge
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture 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, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java index ee6077b073..c4eb5257f2 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java @@ -77,36 +77,39 @@ public class ReconnectServiceGrpc { * A service used to control reconnect server. * */ - @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 responseObserver); - - /** - */ - public void stop(com.google.protobuf.EmptyProtos.Empty request, - io.grpc.stub.StreamObserver 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 responseObserver) { asyncUnimplementedUnaryCall(METHOD_START, responseObserver); } - @java.lang.Override + /** + */ public void stop(com.google.protobuf.EmptyProtos.Empty request, io.grpc.stub.StreamObserver 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. * */ - @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); - } - - /** - *
-   * A service used to control reconnect server.
-   * 
- */ - @java.lang.Deprecated public static interface ReconnectServiceFutureClient { - - /** - */ - public com.google.common.util.concurrent.ListenableFuture start( - com.google.protobuf.EmptyProtos.Empty request); - - /** - */ - public com.google.common.util.concurrent.ListenableFuture stop( - com.google.protobuf.EmptyProtos.Empty request); - } - - public static class ReconnectServiceStub extends io.grpc.stub.AbstractStub - implements ReconnectService { + public static class ReconnectServiceStub extends io.grpc.stub.AbstractStub { 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 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 responseObserver) { asyncUnaryCall( @@ -176,8 +151,12 @@ public class ReconnectServiceGrpc { } } - public static class ReconnectServiceBlockingStub extends io.grpc.stub.AbstractStub - implements ReconnectServiceBlockingClient { + /** + *
+   * A service used to control reconnect server.
+   * 
+ */ + public static class ReconnectServiceBlockingStub extends io.grpc.stub.AbstractStub { 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 - implements ReconnectServiceFutureClient { + /** + *
+   * A service used to control reconnect server.
+   * 
+ */ + public static class ReconnectServiceFutureStub extends io.grpc.stub.AbstractStub { 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 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 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, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java index 7b73fe2dba..591a8d6108 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java @@ -115,7 +115,7 @@ public class TestServiceGrpc { * performance with various types of payload. * */ - @java.lang.Deprecated public static interface TestService { + public static abstract class TestServiceImplBase implements io.grpc.BindableService { /** *
@@ -123,7 +123,9 @@ public class TestServiceGrpc {
      * 
*/ public void emptyCall(com.google.protobuf.EmptyProtos.Empty request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_EMPTY_CALL, responseObserver); + } /** *
@@ -131,7 +133,9 @@ public class TestServiceGrpc {
      * 
*/ public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); + } /** *
@@ -140,7 +144,9 @@ public class TestServiceGrpc {
      * 
*/ public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); + } /** *
@@ -149,7 +155,9 @@ public class TestServiceGrpc {
      * 
*/ public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); + } /** *
@@ -159,7 +167,9 @@ public class TestServiceGrpc {
      * 
*/ public io.grpc.stub.StreamObserver fullDuplexCall( - io.grpc.stub.StreamObserver responseObserver); + io.grpc.stub.StreamObserver responseObserver) { + return asyncUnimplementedStreamingCall(METHOD_FULL_DUPLEX_CALL, responseObserver); + } /** *
@@ -169,51 +179,56 @@ public class TestServiceGrpc {
      * first request.
      * 
*/ - public io.grpc.stub.StreamObserver halfDuplexCall( - io.grpc.stub.StreamObserver 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 responseObserver) { - asyncUnimplementedUnaryCall(METHOD_EMPTY_CALL, responseObserver); - } - - @java.lang.Override - public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); - } - - @java.lang.Override - public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver streamingInputCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); - } - - @java.lang.Override - public io.grpc.stub.StreamObserver fullDuplexCall( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_FULL_DUPLEX_CALL, responseObserver); - } - - @java.lang.Override public io.grpc.stub.StreamObserver halfDuplexCall( io.grpc.stub.StreamObserver 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. * */ - @java.lang.Deprecated public static interface TestServiceBlockingClient { - - /** - *
-     * One empty request followed by one empty response.
-     * 
- */ - public com.google.protobuf.EmptyProtos.Empty emptyCall(com.google.protobuf.EmptyProtos.Empty request); - - /** - *
-     * One request followed by one response.
-     * 
- */ - public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request); - - /** - *
-     * One request followed by a sequence of responses (streamed download).
-     * The server returns the payload with client desired type and sizes.
-     * 
- */ - public java.util.Iterator streamingOutputCall( - io.grpc.testing.integration.Messages.StreamingOutputCallRequest request); - } - - /** - *
-   * A simple service to test the various types of RPCs and experiment with
-   * performance with various types of payload.
-   * 
- */ - @java.lang.Deprecated public static interface TestServiceFutureClient { - - /** - *
-     * One empty request followed by one empty response.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture emptyCall( - com.google.protobuf.EmptyProtos.Empty request); - - /** - *
-     * One request followed by one response.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture unaryCall( - io.grpc.testing.integration.Messages.SimpleRequest request); - } - - public static class TestServiceStub extends io.grpc.stub.AbstractStub - implements TestService { + public static class TestServiceStub extends io.grpc.stub.AbstractStub { private TestServiceStub(io.grpc.Channel channel) { super(channel); } @@ -291,42 +254,73 @@ public class TestServiceGrpc { return new TestServiceStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * One empty request followed by one empty response.
+     * 
+ */ public void emptyCall(com.google.protobuf.EmptyProtos.Empty request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( getChannel().newCall(METHOD_EMPTY_CALL, getCallOptions()), request, responseObserver); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * 
+ */ public void unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); } - @java.lang.Override + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ public void streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request, io.grpc.stub.StreamObserver responseObserver) { asyncServerStreamingCall( getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); } - @java.lang.Override + /** + *
+     * A sequence of requests followed by one response (streamed upload).
+     * The server returns the aggregated size of client payload as the result.
+     * 
+ */ public io.grpc.stub.StreamObserver streamingInputCall( io.grpc.stub.StreamObserver responseObserver) { return asyncClientStreamingCall( getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); } - @java.lang.Override + /** + *
+     * 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.
+     * 
+ */ public io.grpc.stub.StreamObserver fullDuplexCall( io.grpc.stub.StreamObserver responseObserver) { return asyncBidiStreamingCall( getChannel().newCall(METHOD_FULL_DUPLEX_CALL, getCallOptions()), responseObserver); } - @java.lang.Override + /** + *
+     * 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.
+     * 
+ */ public io.grpc.stub.StreamObserver halfDuplexCall( io.grpc.stub.StreamObserver responseObserver) { return asyncBidiStreamingCall( @@ -334,8 +328,13 @@ public class TestServiceGrpc { } } - public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub - implements TestServiceBlockingClient { + /** + *
+   * A simple service to test the various types of RPCs and experiment with
+   * performance with various types of payload.
+   * 
+ */ + public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub { private TestServiceBlockingStub(io.grpc.Channel channel) { super(channel); } @@ -351,19 +350,32 @@ public class TestServiceGrpc { return new TestServiceBlockingStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * One empty request followed by one empty response.
+     * 
+ */ public com.google.protobuf.EmptyProtos.Empty emptyCall(com.google.protobuf.EmptyProtos.Empty request) { return blockingUnaryCall( getChannel(), METHOD_EMPTY_CALL, getCallOptions(), request); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * 
+ */ 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 + /** + *
+     * One request followed by a sequence of responses (streamed download).
+     * The server returns the payload with client desired type and sizes.
+     * 
+ */ public java.util.Iterator 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 - implements TestServiceFutureClient { + /** + *
+   * A simple service to test the various types of RPCs and experiment with
+   * performance with various types of payload.
+   * 
+ */ + public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub { private TestServiceFutureStub(io.grpc.Channel channel) { super(channel); } @@ -388,14 +405,22 @@ public class TestServiceGrpc { return new TestServiceFutureStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * One empty request followed by one empty response.
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture emptyCall( com.google.protobuf.EmptyProtos.Empty request) { return futureUnaryCall( getChannel().newCall(METHOD_EMPTY_CALL, getCallOptions()), request); } - @java.lang.Override + /** + *
+     * One request followed by one response.
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture 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, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java index b22e6fbdb2..4cfa5d8cb9 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java @@ -70,28 +70,28 @@ public class UnimplementedServiceGrpc { * that case. * */ - @java.lang.Deprecated public static interface UnimplementedService { + public static abstract class UnimplementedServiceImplBase implements io.grpc.BindableService { /** *
      * A call that no server should implement
      * 
*/ - public void unimplementedCall(com.google.protobuf.EmptyProtos.Empty request, - io.grpc.stub.StreamObserver 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 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. * */ - @java.lang.Deprecated public static interface UnimplementedServiceBlockingClient { - - /** - *
-     * A call that no server should implement
-     * 
- */ - public com.google.protobuf.EmptyProtos.Empty unimplementedCall(com.google.protobuf.EmptyProtos.Empty request); - } - - /** - *
-   * A simple service NOT implemented at servers so clients can test for
-   * that case.
-   * 
- */ - @java.lang.Deprecated public static interface UnimplementedServiceFutureClient { - - /** - *
-     * A call that no server should implement
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture unimplementedCall( - com.google.protobuf.EmptyProtos.Empty request); - } - - public static class UnimplementedServiceStub extends io.grpc.stub.AbstractStub - implements UnimplementedService { + public static class UnimplementedServiceStub extends io.grpc.stub.AbstractStub { private UnimplementedServiceStub(io.grpc.Channel channel) { super(channel); } @@ -145,7 +117,11 @@ public class UnimplementedServiceGrpc { return new UnimplementedServiceStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * A call that no server should implement
+     * 
+ */ public void unimplementedCall(com.google.protobuf.EmptyProtos.Empty request, io.grpc.stub.StreamObserver responseObserver) { asyncUnaryCall( @@ -153,8 +129,13 @@ public class UnimplementedServiceGrpc { } } - public static class UnimplementedServiceBlockingStub extends io.grpc.stub.AbstractStub - implements UnimplementedServiceBlockingClient { + /** + *
+   * A simple service NOT implemented at servers so clients can test for
+   * that case.
+   * 
+ */ + public static class UnimplementedServiceBlockingStub extends io.grpc.stub.AbstractStub { private UnimplementedServiceBlockingStub(io.grpc.Channel channel) { super(channel); } @@ -170,15 +151,24 @@ public class UnimplementedServiceGrpc { return new UnimplementedServiceBlockingStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * A call that no server should implement
+     * 
+ */ 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 - implements UnimplementedServiceFutureClient { + /** + *
+   * A simple service NOT implemented at servers so clients can test for
+   * that case.
+   * 
+ */ + public static class UnimplementedServiceFutureStub extends io.grpc.stub.AbstractStub { private UnimplementedServiceFutureStub(io.grpc.Channel channel) { super(channel); } @@ -194,7 +184,11 @@ public class UnimplementedServiceGrpc { return new UnimplementedServiceFutureStub(channel, callOptions); } - @java.lang.Override + /** + *
+     * A call that no server should implement
+     * 
+ */ public com.google.common.util.concurrent.ListenableFuture 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 implements @@ -211,10 +203,10 @@ public class UnimplementedServiceGrpc { io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } } diff --git a/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java b/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java index 689aefd248..54f1f9df19 100644 --- a/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java @@ -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 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 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 check( - io.grpc.health.v1.HealthCheckRequest request); - } - - public static class HealthStub extends io.grpc.stub.AbstractStub - implements Health { + public static class HealthStub extends io.grpc.stub.AbstractStub { 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 responseObserver) { asyncUnaryCall( @@ -128,8 +111,9 @@ public class HealthGrpc { } } - public static class HealthBlockingStub extends io.grpc.stub.AbstractStub - implements HealthBlockingClient { + /** + */ + public static class HealthBlockingStub extends io.grpc.stub.AbstractStub { 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 - implements HealthFutureClient { + /** + */ + public static class HealthFutureStub extends io.grpc.stub.AbstractStub { 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 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 implements @@ -186,10 +171,10 @@ public class HealthGrpc { io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - 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(); - } }