diff options
author | Carl Mastrangelo <notcarl@google.com> | 2017-10-30 10:30:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-30 10:30:34 -0700 |
commit | 30b59885b7496b53eb17f64ba1d822c2d9a6c69a (patch) | |
tree | eab8390b6f1568020e811be297ee5f85cb5e900e /benchmarks | |
parent | 53c135a48f979e236678af40aa88909f6564ec97 (diff) | |
download | grpc-grpc-java-30b59885b7496b53eb17f64ba1d822c2d9a6c69a.tar.gz |
compiler: add methods for accessing method descriptors
* MethodDescriptor is lazy loaded, so protobuf loading only happens on demand. This also means tracing registration happens on demand.
* The names of the getters all being with `method`. This makes it harder for autocomplete to pick them up.
* A new field is used, which matches the getter name. Rather than make the new-getters reference the old-fields, make the old-fields reference the new getters. This makes removal of the old-fields a simple operation.
* The getters may not be inlineable, but thats an easy fix if it ends up being a problem. Not worth premature optimization (but is worth future work).
The expected timeline for this is adding this to the 1.8 cut, and deprecating the old-fields. They will be removed in 1.9.
Diffstat (limited to 'benchmarks')
5 files changed, 333 insertions, 153 deletions
diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java index 3bf0a6b07..b357adae6 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java @@ -28,75 +28,165 @@ public final class BenchmarkServiceGrpc { // Static method descriptors that strictly reflect the proto. @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getUnaryCallMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, - io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_UNARY_CALL = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName( - "grpc.testing.BenchmarkService", "UnaryCall")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) - .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("UnaryCall")) - .build(); + io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_UNARY_CALL = getUnaryCallMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod; + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod; + if ((getUnaryCallMethod = BenchmarkServiceGrpc.getUnaryCallMethod) == null) { + synchronized (BenchmarkServiceGrpc.class) { + if ((getUnaryCallMethod = BenchmarkServiceGrpc.getUnaryCallMethod) == null) { + BenchmarkServiceGrpc.getUnaryCallMethod = getUnaryCallMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "grpc.testing.BenchmarkService", "UnaryCall")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) + .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("UnaryCall")) + .build(); + } + } + } + return getUnaryCallMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getStreamingCallMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, - io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_CALL = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName( - "grpc.testing.BenchmarkService", "StreamingCall")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) - .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingCall")) - .build(); + io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_CALL = getStreamingCallMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod; + if ((getStreamingCallMethod = BenchmarkServiceGrpc.getStreamingCallMethod) == null) { + synchronized (BenchmarkServiceGrpc.class) { + if ((getStreamingCallMethod = BenchmarkServiceGrpc.getStreamingCallMethod) == null) { + BenchmarkServiceGrpc.getStreamingCallMethod = getStreamingCallMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName( + "grpc.testing.BenchmarkService", "StreamingCall")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) + .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingCall")) + .build(); + } + } + } + return getStreamingCallMethod; + } @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getStreamingFromClientMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, - io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_FROM_CLIENT = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) - .setFullMethodName(generateFullMethodName( - "grpc.testing.BenchmarkService", "StreamingFromClient")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) - .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromClient")) - .build(); + io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_FROM_CLIENT = getStreamingFromClientMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod; + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod; + if ((getStreamingFromClientMethod = BenchmarkServiceGrpc.getStreamingFromClientMethod) == null) { + synchronized (BenchmarkServiceGrpc.class) { + if ((getStreamingFromClientMethod = BenchmarkServiceGrpc.getStreamingFromClientMethod) == null) { + BenchmarkServiceGrpc.getStreamingFromClientMethod = getStreamingFromClientMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) + .setFullMethodName(generateFullMethodName( + "grpc.testing.BenchmarkService", "StreamingFromClient")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) + .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromClient")) + .build(); + } + } + } + return getStreamingFromClientMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getStreamingFromServerMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, - io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_FROM_SERVER = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) - .setFullMethodName(generateFullMethodName( - "grpc.testing.BenchmarkService", "StreamingFromServer")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) - .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromServer")) - .build(); + io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_FROM_SERVER = getStreamingFromServerMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod; + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod; + if ((getStreamingFromServerMethod = BenchmarkServiceGrpc.getStreamingFromServerMethod) == null) { + synchronized (BenchmarkServiceGrpc.class) { + if ((getStreamingFromServerMethod = BenchmarkServiceGrpc.getStreamingFromServerMethod) == null) { + BenchmarkServiceGrpc.getStreamingFromServerMethod = getStreamingFromServerMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName( + "grpc.testing.BenchmarkService", "StreamingFromServer")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) + .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromServer")) + .build(); + } + } + } + return getStreamingFromServerMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getStreamingBothWaysMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, - io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_BOTH_WAYS = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName( - "grpc.testing.BenchmarkService", "StreamingBothWays")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) - .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingBothWays")) - .build(); + io.grpc.benchmarks.proto.Messages.SimpleResponse> METHOD_STREAMING_BOTH_WAYS = getStreamingBothWaysMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, + io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod; + if ((getStreamingBothWaysMethod = BenchmarkServiceGrpc.getStreamingBothWaysMethod) == null) { + synchronized (BenchmarkServiceGrpc.class) { + if ((getStreamingBothWaysMethod = BenchmarkServiceGrpc.getStreamingBothWaysMethod) == null) { + BenchmarkServiceGrpc.getStreamingBothWaysMethod = getStreamingBothWaysMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName( + "grpc.testing.BenchmarkService", "StreamingBothWays")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance())) + .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingBothWays")) + .build(); + } + } + } + return getStreamingBothWaysMethod; + } /** * Creates a new async stub that supports all call types for the service @@ -133,7 +223,7 @@ public final class BenchmarkServiceGrpc { */ public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { - asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); + asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver); } /** @@ -145,7 +235,7 @@ public final class BenchmarkServiceGrpc { */ public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_CALL, responseObserver); + return asyncUnimplementedStreamingCall(getStreamingCallMethod(), responseObserver); } /** @@ -156,7 +246,7 @@ public final class BenchmarkServiceGrpc { */ public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingFromClient( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_FROM_CLIENT, responseObserver); + return asyncUnimplementedStreamingCall(getStreamingFromClientMethod(), responseObserver); } /** @@ -167,7 +257,7 @@ public final class BenchmarkServiceGrpc { */ public void streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { - asyncUnimplementedUnaryCall(METHOD_STREAMING_FROM_SERVER, responseObserver); + asyncUnimplementedUnaryCall(getStreamingFromServerMethod(), responseObserver); } /** @@ -178,7 +268,7 @@ public final class BenchmarkServiceGrpc { */ public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingBothWays( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { - return asyncUnimplementedStreamingCall(METHOD_STREAMING_BOTH_WAYS, responseObserver); + return asyncUnimplementedStreamingCall(getStreamingBothWaysMethod(), responseObserver); } @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { @@ -249,7 +339,7 @@ public final class BenchmarkServiceGrpc { public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { asyncUnaryCall( - getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); + getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver); } /** @@ -262,7 +352,7 @@ public final class BenchmarkServiceGrpc { public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { return asyncBidiStreamingCall( - getChannel().newCall(METHOD_STREAMING_CALL, getCallOptions()), responseObserver); + getChannel().newCall(getStreamingCallMethod(), getCallOptions()), responseObserver); } /** @@ -274,7 +364,7 @@ public final class BenchmarkServiceGrpc { public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingFromClient( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { return asyncClientStreamingCall( - getChannel().newCall(METHOD_STREAMING_FROM_CLIENT, getCallOptions()), responseObserver); + getChannel().newCall(getStreamingFromClientMethod(), getCallOptions()), responseObserver); } /** @@ -286,7 +376,7 @@ public final class BenchmarkServiceGrpc { public void streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { asyncServerStreamingCall( - getChannel().newCall(METHOD_STREAMING_FROM_SERVER, getCallOptions()), request, responseObserver); + getChannel().newCall(getStreamingFromServerMethod(), getCallOptions()), request, responseObserver); } /** @@ -298,7 +388,7 @@ public final class BenchmarkServiceGrpc { public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingBothWays( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) { return asyncBidiStreamingCall( - getChannel().newCall(METHOD_STREAMING_BOTH_WAYS, getCallOptions()), responseObserver); + getChannel().newCall(getStreamingBothWaysMethod(), getCallOptions()), responseObserver); } } @@ -328,7 +418,7 @@ public final class BenchmarkServiceGrpc { */ public io.grpc.benchmarks.proto.Messages.SimpleResponse unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request) { return blockingUnaryCall( - getChannel(), METHOD_UNARY_CALL, getCallOptions(), request); + getChannel(), getUnaryCallMethod(), getCallOptions(), request); } /** @@ -340,7 +430,7 @@ public final class BenchmarkServiceGrpc { public java.util.Iterator<io.grpc.benchmarks.proto.Messages.SimpleResponse> streamingFromServer( io.grpc.benchmarks.proto.Messages.SimpleRequest request) { return blockingServerStreamingCall( - getChannel(), METHOD_STREAMING_FROM_SERVER, getCallOptions(), request); + getChannel(), getStreamingFromServerMethod(), getCallOptions(), request); } } @@ -371,7 +461,7 @@ public final class BenchmarkServiceGrpc { public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Messages.SimpleResponse> unaryCall( io.grpc.benchmarks.proto.Messages.SimpleRequest request) { return futureUnaryCall( - getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request); + getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request); } } diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java index 07f637586..aba16bcb1 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java @@ -28,19 +28,37 @@ public final class ReportQpsScenarioServiceGrpc { // Static method descriptors that strictly reflect the proto. @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getReportScenarioMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ScenarioResult, - io.grpc.benchmarks.proto.Control.Void> METHOD_REPORT_SCENARIO = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ScenarioResult, io.grpc.benchmarks.proto.Control.Void>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName( - "grpc.testing.ReportQpsScenarioService", "ReportScenario")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.ScenarioResult.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.Void.getDefaultInstance())) - .setSchemaDescriptor(new ReportQpsScenarioServiceMethodDescriptorSupplier("ReportScenario")) - .build(); + io.grpc.benchmarks.proto.Control.Void> METHOD_REPORT_SCENARIO = getReportScenarioMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ScenarioResult, + io.grpc.benchmarks.proto.Control.Void> getReportScenarioMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ScenarioResult, + io.grpc.benchmarks.proto.Control.Void> getReportScenarioMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ScenarioResult, io.grpc.benchmarks.proto.Control.Void> getReportScenarioMethod; + if ((getReportScenarioMethod = ReportQpsScenarioServiceGrpc.getReportScenarioMethod) == null) { + synchronized (ReportQpsScenarioServiceGrpc.class) { + if ((getReportScenarioMethod = ReportQpsScenarioServiceGrpc.getReportScenarioMethod) == null) { + ReportQpsScenarioServiceGrpc.getReportScenarioMethod = getReportScenarioMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ScenarioResult, io.grpc.benchmarks.proto.Control.Void>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "grpc.testing.ReportQpsScenarioService", "ReportScenario")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.ScenarioResult.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.Void.getDefaultInstance())) + .setSchemaDescriptor(new ReportQpsScenarioServiceMethodDescriptorSupplier("ReportScenario")) + .build(); + } + } + } + return getReportScenarioMethod; + } /** * Creates a new async stub that supports all call types for the service @@ -76,7 +94,7 @@ public final class ReportQpsScenarioServiceGrpc { */ public void reportScenario(io.grpc.benchmarks.proto.Control.ScenarioResult request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver) { - asyncUnimplementedUnaryCall(METHOD_REPORT_SCENARIO, responseObserver); + asyncUnimplementedUnaryCall(getReportScenarioMethod(), responseObserver); } @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { @@ -118,7 +136,7 @@ public final class ReportQpsScenarioServiceGrpc { public void reportScenario(io.grpc.benchmarks.proto.Control.ScenarioResult request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver) { asyncUnaryCall( - getChannel().newCall(METHOD_REPORT_SCENARIO, getCallOptions()), request, responseObserver); + getChannel().newCall(getReportScenarioMethod(), getCallOptions()), request, responseObserver); } } @@ -147,7 +165,7 @@ public final class ReportQpsScenarioServiceGrpc { */ public io.grpc.benchmarks.proto.Control.Void reportScenario(io.grpc.benchmarks.proto.Control.ScenarioResult request) { return blockingUnaryCall( - getChannel(), METHOD_REPORT_SCENARIO, getCallOptions(), request); + getChannel(), getReportScenarioMethod(), getCallOptions(), request); } } @@ -177,7 +195,7 @@ public final class ReportQpsScenarioServiceGrpc { public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.Void> reportScenario( io.grpc.benchmarks.proto.Control.ScenarioResult request) { return futureUnaryCall( - getChannel().newCall(METHOD_REPORT_SCENARIO, getCallOptions()), request); + getChannel().newCall(getReportScenarioMethod(), getCallOptions()), request); } } diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java index 490361cca..50fb42163 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java @@ -28,61 +28,133 @@ public final class WorkerServiceGrpc { // Static method descriptors that strictly reflect the proto. @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getRunServerMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ServerArgs, - io.grpc.benchmarks.proto.Control.ServerStatus> METHOD_RUN_SERVER = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ServerArgs, io.grpc.benchmarks.proto.Control.ServerStatus>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName( - "grpc.testing.WorkerService", "RunServer")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.ServerArgs.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.ServerStatus.getDefaultInstance())) - .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunServer")) - .build(); + io.grpc.benchmarks.proto.Control.ServerStatus> METHOD_RUN_SERVER = getRunServerMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ServerArgs, + io.grpc.benchmarks.proto.Control.ServerStatus> getRunServerMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ServerArgs, + io.grpc.benchmarks.proto.Control.ServerStatus> getRunServerMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ServerArgs, io.grpc.benchmarks.proto.Control.ServerStatus> getRunServerMethod; + if ((getRunServerMethod = WorkerServiceGrpc.getRunServerMethod) == null) { + synchronized (WorkerServiceGrpc.class) { + if ((getRunServerMethod = WorkerServiceGrpc.getRunServerMethod) == null) { + WorkerServiceGrpc.getRunServerMethod = getRunServerMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ServerArgs, io.grpc.benchmarks.proto.Control.ServerStatus>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName( + "grpc.testing.WorkerService", "RunServer")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.ServerArgs.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.ServerStatus.getDefaultInstance())) + .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunServer")) + .build(); + } + } + } + return getRunServerMethod; + } @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getRunClientMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ClientArgs, - io.grpc.benchmarks.proto.Control.ClientStatus> METHOD_RUN_CLIENT = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ClientArgs, io.grpc.benchmarks.proto.Control.ClientStatus>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName( - "grpc.testing.WorkerService", "RunClient")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.ClientArgs.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.ClientStatus.getDefaultInstance())) - .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunClient")) - .build(); + io.grpc.benchmarks.proto.Control.ClientStatus> METHOD_RUN_CLIENT = getRunClientMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ClientArgs, + io.grpc.benchmarks.proto.Control.ClientStatus> getRunClientMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ClientArgs, + io.grpc.benchmarks.proto.Control.ClientStatus> getRunClientMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ClientArgs, io.grpc.benchmarks.proto.Control.ClientStatus> getRunClientMethod; + if ((getRunClientMethod = WorkerServiceGrpc.getRunClientMethod) == null) { + synchronized (WorkerServiceGrpc.class) { + if ((getRunClientMethod = WorkerServiceGrpc.getRunClientMethod) == null) { + WorkerServiceGrpc.getRunClientMethod = getRunClientMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ClientArgs, io.grpc.benchmarks.proto.Control.ClientStatus>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName( + "grpc.testing.WorkerService", "RunClient")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.ClientArgs.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.ClientStatus.getDefaultInstance())) + .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunClient")) + .build(); + } + } + } + return getRunClientMethod; + } @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getCoreCountMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.CoreRequest, - io.grpc.benchmarks.proto.Control.CoreResponse> METHOD_CORE_COUNT = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.CoreRequest, io.grpc.benchmarks.proto.Control.CoreResponse>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName( - "grpc.testing.WorkerService", "CoreCount")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.CoreRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.CoreResponse.getDefaultInstance())) - .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("CoreCount")) - .build(); + io.grpc.benchmarks.proto.Control.CoreResponse> METHOD_CORE_COUNT = getCoreCountMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.CoreRequest, + io.grpc.benchmarks.proto.Control.CoreResponse> getCoreCountMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.CoreRequest, + io.grpc.benchmarks.proto.Control.CoreResponse> getCoreCountMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.CoreRequest, io.grpc.benchmarks.proto.Control.CoreResponse> getCoreCountMethod; + if ((getCoreCountMethod = WorkerServiceGrpc.getCoreCountMethod) == null) { + synchronized (WorkerServiceGrpc.class) { + if ((getCoreCountMethod = WorkerServiceGrpc.getCoreCountMethod) == null) { + WorkerServiceGrpc.getCoreCountMethod = getCoreCountMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.CoreRequest, io.grpc.benchmarks.proto.Control.CoreResponse>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "grpc.testing.WorkerService", "CoreCount")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.CoreRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.CoreResponse.getDefaultInstance())) + .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("CoreCount")) + .build(); + } + } + } + return getCoreCountMethod; + } @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link getQuitWorkerMethod()} instead. public static final io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.Void, - io.grpc.benchmarks.proto.Control.Void> METHOD_QUIT_WORKER = - io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.Void, io.grpc.benchmarks.proto.Control.Void>newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName( - "grpc.testing.WorkerService", "QuitWorker")) - .setRegisterForTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.Void.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.grpc.benchmarks.proto.Control.Void.getDefaultInstance())) - .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("QuitWorker")) - .build(); + io.grpc.benchmarks.proto.Control.Void> METHOD_QUIT_WORKER = getQuitWorkerMethod(); + + private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.Void, + io.grpc.benchmarks.proto.Control.Void> getQuitWorkerMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.Void, + io.grpc.benchmarks.proto.Control.Void> getQuitWorkerMethod() { + io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.Void, io.grpc.benchmarks.proto.Control.Void> getQuitWorkerMethod; + if ((getQuitWorkerMethod = WorkerServiceGrpc.getQuitWorkerMethod) == null) { + synchronized (WorkerServiceGrpc.class) { + if ((getQuitWorkerMethod = WorkerServiceGrpc.getQuitWorkerMethod) == null) { + WorkerServiceGrpc.getQuitWorkerMethod = getQuitWorkerMethod = + io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.Void, io.grpc.benchmarks.proto.Control.Void>newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "grpc.testing.WorkerService", "QuitWorker")) + .setRegisterForTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.Void.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.grpc.benchmarks.proto.Control.Void.getDefaultInstance())) + .setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("QuitWorker")) + .build(); + } + } + } + return getQuitWorkerMethod; + } /** * Creates a new async stub that supports all call types for the service @@ -123,7 +195,7 @@ public final class WorkerServiceGrpc { */ 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); + return asyncUnimplementedStreamingCall(getRunServerMethod(), responseObserver); } /** @@ -138,7 +210,7 @@ public final class WorkerServiceGrpc { */ 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); + return asyncUnimplementedStreamingCall(getRunClientMethod(), responseObserver); } /** @@ -148,7 +220,7 @@ public final class WorkerServiceGrpc { */ 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); + asyncUnimplementedUnaryCall(getCoreCountMethod(), responseObserver); } /** @@ -158,7 +230,7 @@ public final class WorkerServiceGrpc { */ public void quitWorker(io.grpc.benchmarks.proto.Control.Void request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver) { - asyncUnimplementedUnaryCall(METHOD_QUIT_WORKER, responseObserver); + asyncUnimplementedUnaryCall(getQuitWorkerMethod(), responseObserver); } @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { @@ -226,7 +298,7 @@ public final class WorkerServiceGrpc { public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerArgs> runServer( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ServerStatus> responseObserver) { return asyncBidiStreamingCall( - getChannel().newCall(METHOD_RUN_SERVER, getCallOptions()), responseObserver); + getChannel().newCall(getRunServerMethod(), getCallOptions()), responseObserver); } /** @@ -242,7 +314,7 @@ public final class WorkerServiceGrpc { public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientArgs> runClient( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.ClientStatus> responseObserver) { return asyncBidiStreamingCall( - getChannel().newCall(METHOD_RUN_CLIENT, getCallOptions()), responseObserver); + getChannel().newCall(getRunClientMethod(), getCallOptions()), responseObserver); } /** @@ -253,7 +325,7 @@ public final class WorkerServiceGrpc { public void coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.CoreResponse> responseObserver) { asyncUnaryCall( - getChannel().newCall(METHOD_CORE_COUNT, getCallOptions()), request, responseObserver); + getChannel().newCall(getCoreCountMethod(), getCallOptions()), request, responseObserver); } /** @@ -264,7 +336,7 @@ public final class WorkerServiceGrpc { public void quitWorker(io.grpc.benchmarks.proto.Control.Void request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Control.Void> responseObserver) { asyncUnaryCall( - getChannel().newCall(METHOD_QUIT_WORKER, getCallOptions()), request, responseObserver); + getChannel().newCall(getQuitWorkerMethod(), getCallOptions()), request, responseObserver); } } @@ -293,7 +365,7 @@ public final class WorkerServiceGrpc { */ public io.grpc.benchmarks.proto.Control.CoreResponse coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request) { return blockingUnaryCall( - getChannel(), METHOD_CORE_COUNT, getCallOptions(), request); + getChannel(), getCoreCountMethod(), getCallOptions(), request); } /** @@ -303,7 +375,7 @@ public final class WorkerServiceGrpc { */ public io.grpc.benchmarks.proto.Control.Void quitWorker(io.grpc.benchmarks.proto.Control.Void request) { return blockingUnaryCall( - getChannel(), METHOD_QUIT_WORKER, getCallOptions(), request); + getChannel(), getQuitWorkerMethod(), getCallOptions(), request); } } @@ -333,7 +405,7 @@ public final class WorkerServiceGrpc { public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.CoreResponse> coreCount( io.grpc.benchmarks.proto.Control.CoreRequest request) { return futureUnaryCall( - getChannel().newCall(METHOD_CORE_COUNT, getCallOptions()), request); + getChannel().newCall(getCoreCountMethod(), getCallOptions()), request); } /** @@ -344,7 +416,7 @@ public final class WorkerServiceGrpc { public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Control.Void> quitWorker( io.grpc.benchmarks.proto.Control.Void request) { return futureUnaryCall( - getChannel().newCall(METHOD_QUIT_WORKER, getCallOptions()), request); + getChannel().newCall(getQuitWorkerMethod(), getCallOptions()), request); } } diff --git a/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java b/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java index 2ddb47cfa..57ebef77a 100644 --- a/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java +++ b/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java @@ -65,8 +65,8 @@ public class SingleThreadBlockingQpsBenchmark extends AbstractBenchmark { * Issue a unary call and wait for the response. */ @Benchmark - public void blockingUnary() throws Exception { - ClientCalls.blockingUnaryCall( + public Object blockingUnary() throws Exception { + return ClientCalls.blockingUnaryCall( channels[0].newCall(unaryMethod, CallOptions.DEFAULT), Unpooled.EMPTY_BUFFER); } diff --git a/benchmarks/src/main/java/io/grpc/benchmarks/driver/LoadServer.java b/benchmarks/src/main/java/io/grpc/benchmarks/driver/LoadServer.java index 09fcb06c2..cfbffa4e9 100644 --- a/benchmarks/src/main/java/io/grpc/benchmarks/driver/LoadServer.java +++ b/benchmarks/src/main/java/io/grpc/benchmarks/driver/LoadServer.java @@ -60,14 +60,14 @@ final class LoadServer { * Generic version of the unary method call. */ static final MethodDescriptor<ByteBuf, ByteBuf> GENERIC_UNARY_METHOD = - BenchmarkServiceGrpc.METHOD_UNARY_CALL.toBuilder(marshaller, marshaller) + BenchmarkServiceGrpc.getUnaryCallMethod().toBuilder(marshaller, marshaller) .build(); /** * Generic version of the streaming ping-pong method call. */ static final MethodDescriptor<ByteBuf, ByteBuf> GENERIC_STREAMING_PING_PONG_METHOD = - BenchmarkServiceGrpc.METHOD_STREAMING_CALL.toBuilder(marshaller, marshaller) + BenchmarkServiceGrpc.getStreamingCallMethod().toBuilder(marshaller, marshaller) .build(); private static final Logger log = Logger.getLogger(LoadServer.class.getName()); |