compiler: add build option to enable deprecated generated code

partially resolving #1469

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,11 +37,16 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
java_grpc_generator::ProtoFlavor flavor = java_grpc_generator::ProtoFlavor flavor =
java_grpc_generator::ProtoFlavor::NORMAL; 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++) { for (int i = 0; i < options.size(); i++) {
if (options[i].first == "nano") { if (options[i].first == "nano") {
flavor = java_grpc_generator::ProtoFlavor::NANO; flavor = java_grpc_generator::ProtoFlavor::NANO;
} else if (options[i].first == "lite") { } else if (options[i].first == "lite") {
flavor = java_grpc_generator::ProtoFlavor::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"; + java_grpc_generator::ServiceClassName(service) + ".java";
std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output( std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->Open(filename)); context->Open(filename));
java_grpc_generator::GenerateService(service, output.get(), flavor); java_grpc_generator::GenerateService(service, output.get(), flavor, enable_deprecated);
} }
return true; return true;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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