aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorCarl Mastrangelo <notcarl@google.com>2017-10-30 10:30:34 -0700
committerGitHub <noreply@github.com>2017-10-30 10:30:34 -0700
commit30b59885b7496b53eb17f64ba1d822c2d9a6c69a (patch)
treeeab8390b6f1568020e811be297ee5f85cb5e900e /compiler
parent53c135a48f979e236678af40aa88909f6564ec97 (diff)
downloadgrpc-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 'compiler')
-rw-r--r--compiler/src/java_plugin/cpp/java_generator.cpp103
-rw-r--r--compiler/src/test/golden/TestService.java.txt236
-rw-r--r--compiler/src/testLite/golden/TestService.java.txt226
-rw-r--r--compiler/src/testNano/golden/TestService.java.txt226
4 files changed, 553 insertions, 238 deletions
diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp
index 538d482a6..c0c9ce244 100644
--- a/compiler/src/java_plugin/cpp/java_generator.cpp
+++ b/compiler/src/java_plugin/cpp/java_generator.cpp
@@ -74,6 +74,10 @@ static inline string MethodPropertiesFieldName(const MethodDescriptor* method) {
return "METHOD_" + ToAllUpperCase(method->name());
}
+static inline string MethodPropertiesGetterName(const MethodDescriptor* method) {
+ return MixedLower("get_" + method->name() + "_method");
+}
+
static inline string MethodIdFieldName(const MethodDescriptor* method) {
return "METHODID_" + ToAllUpperCase(method->name());
}
@@ -313,6 +317,8 @@ static void PrintMethodFields(
(*vars)["output_type"] = MessageFullJavaName(flavor == ProtoFlavor::NANO,
method->output_type());
(*vars)["method_field_name"] = MethodPropertiesFieldName(method);
+ (*vars)["method_new_field_name"] = MethodPropertiesGetterName(method);
+ (*vars)["method_method_name"] = MethodPropertiesGetterName(method);
bool client_streaming = method->client_streaming();
bool server_streaming = method->server_streaming();
if (client_streaming) {
@@ -338,18 +344,36 @@ static void PrintMethodFields(
"private static final int ARG_IN_$method_field_name$ = $arg_in_id$;\n"
"private static final int ARG_OUT_$method_field_name$ = $arg_out_id$;\n"
"@$ExperimentalApi$(\"https://github.com/grpc/grpc-java/issues/1901\")\n"
+ "@$Deprecated$ // Use {@link $method_method_name$()} instead. \n"
"public static final $MethodDescriptor$<$input_type$,\n"
- " $output_type$> $method_field_name$ =\n"
- " $MethodDescriptor$.<$input_type$, $output_type$>newBuilder()\n"
- " .setType($MethodType$.$method_type$)\n"
- " .setFullMethodName(generateFullMethodName(\n"
- " \"$Package$$service_name$\", \"$method_name$\"))\n"
- " .setRegisterForTracing(true)\n"
- " .setRequestMarshaller($NanoUtils$.<$input_type$>marshaller(\n"
- " new NanoFactory<$input_type$>(ARG_IN_$method_field_name$)))\n"
- " .setResponseMarshaller($NanoUtils$.<$output_type$>marshaller(\n"
- " new NanoFactory<$output_type$>(ARG_OUT_$method_field_name$)))\n"
- " .build();\n");
+ " $output_type$> $method_field_name$ = $method_method_name$();\n"
+ "\n"
+ "private static volatile $MethodDescriptor$<$input_type$,\n"
+ " $output_type$> $method_new_field_name$;\n"
+ "\n"
+ "@$ExperimentalApi$(\"https://github.com/grpc/grpc-java/issues/1901\")\n"
+ "public static $MethodDescriptor$<$input_type$,\n"
+ " $output_type$> $method_method_name$() {\n"
+ " $MethodDescriptor$<$input_type$, $output_type$> $method_new_field_name$;\n"
+ " if (($method_new_field_name$ = $service_class_name$.$method_new_field_name$) == null) {\n"
+ " synchronized ($service_class_name$.class) {\n"
+ " if (($method_new_field_name$ = $service_class_name$.$method_new_field_name$) == null) {\n"
+ " $service_class_name$.$method_new_field_name$ = $method_new_field_name$ = \n"
+ " $MethodDescriptor$.<$input_type$, $output_type$>newBuilder()\n"
+ " .setType($MethodType$.$method_type$)\n"
+ " .setFullMethodName(generateFullMethodName(\n"
+ " \"$Package$$service_name$\", \"$method_name$\"))\n"
+ " .setRegisterForTracing(true)\n"
+ " .setRequestMarshaller($NanoUtils$.<$input_type$>marshaller(\n"
+ " new NanoFactory<$input_type$>(ARG_IN_$method_field_name$)))\n"
+ " .setResponseMarshaller($NanoUtils$.<$output_type$>marshaller(\n"
+ " new NanoFactory<$output_type$>(ARG_OUT_$method_field_name$)))\n"
+ " .build();\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ " return $method_new_field_name$;\n"
+ "}\n");
} else {
if (flavor == ProtoFlavor::LITE) {
(*vars)["ProtoUtils"] = "io.grpc.protobuf.lite.ProtoLiteUtils";
@@ -359,28 +383,48 @@ static void PrintMethodFields(
p->Print(
*vars,
"@$ExperimentalApi$(\"https://github.com/grpc/grpc-java/issues/1901\")\n"
+ "@$Deprecated$ // Use {@link $method_method_name$()} instead. \n"
"public static final $MethodDescriptor$<$input_type$,\n"
- " $output_type$> $method_field_name$ =\n"
- " $MethodDescriptor$.<$input_type$, $output_type$>newBuilder()\n"
- " .setType($MethodType$.$method_type$)\n"
- " .setFullMethodName(generateFullMethodName(\n"
- " \"$Package$$service_name$\", \"$method_name$\"))\n"
- " .setRegisterForTracing(true)\n"
- " .setRequestMarshaller($ProtoUtils$.marshaller(\n"
- " $input_type$.getDefaultInstance()))\n"
- " .setResponseMarshaller($ProtoUtils$.marshaller(\n"
- " $output_type$.getDefaultInstance()))\n");
+ " $output_type$> $method_field_name$ = $method_method_name$();\n"
+ "\n"
+ "private static volatile $MethodDescriptor$<$input_type$,\n"
+ " $output_type$> $method_new_field_name$;\n"
+ "\n"
+ "@$ExperimentalApi$(\"https://github.com/grpc/grpc-java/issues/1901\")\n"
+ "public static $MethodDescriptor$<$input_type$,\n"
+ " $output_type$> $method_method_name$() {\n"
+ " $MethodDescriptor$<$input_type$, $output_type$> $method_new_field_name$;\n"
+ " if (($method_new_field_name$ = $service_class_name$.$method_new_field_name$) == null) {\n"
+ " synchronized ($service_class_name$.class) {\n"
+ " if (($method_new_field_name$ = $service_class_name$.$method_new_field_name$) == null) {\n"
+ " $service_class_name$.$method_new_field_name$ = $method_new_field_name$ = \n"
+ " $MethodDescriptor$.<$input_type$, $output_type$>newBuilder()\n"
+ " .setType($MethodType$.$method_type$)\n"
+ " .setFullMethodName(generateFullMethodName(\n"
+ " \"$Package$$service_name$\", \"$method_name$\"))\n"
+ " .setRegisterForTracing(true)\n"
+ " .setRequestMarshaller($ProtoUtils$.marshaller(\n"
+ " $input_type$.getDefaultInstance()))\n"
+ " .setResponseMarshaller($ProtoUtils$.marshaller(\n"
+ " $output_type$.getDefaultInstance()))\n");
(*vars)["proto_method_descriptor_supplier"] = service->name() + "MethodDescriptorSupplier";
if (flavor == ProtoFlavor::NORMAL) {
p->Print(
*vars,
- " .setSchemaDescriptor(new $proto_method_descriptor_supplier$(\"$method_name$\"))\n");
+ " .setSchemaDescriptor(new $proto_method_descriptor_supplier$(\"$method_name$\"))\n");
}
p->Print(
*vars,
- " .build();\n");
+ " .build();\n");
+ p->Print(*vars,
+ " }\n"
+ " }\n"
+ " }\n"
+ " return $method_new_field_name$;\n"
+ "}\n");
+
}
}
p->Print("\n");
@@ -553,7 +597,7 @@ static void PrintStub(
(*vars)["output_type"] = MessageFullJavaName(generate_nano,
method->output_type());
(*vars)["lower_method_name"] = LowerMethodName(method);
- (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
+ (*vars)["method_method_name"] = MethodPropertiesGetterName(method);
bool client_streaming = method->client_streaming();
bool server_streaming = method->server_streaming();
@@ -633,11 +677,11 @@ static void PrintStub(
if (client_streaming) {
p->Print(
*vars,
- "return asyncUnimplementedStreamingCall($method_field_name$, responseObserver);\n");
+ "return asyncUnimplementedStreamingCall($method_method_name$(), responseObserver);\n");
} else {
p->Print(
*vars,
- "asyncUnimplementedUnaryCall($method_field_name$, responseObserver);\n");
+ "asyncUnimplementedUnaryCall($method_method_name$(), responseObserver);\n");
}
break;
default:
@@ -658,7 +702,7 @@ static void PrintStub(
p->Print(
*vars,
"return $calls_method$(\n"
- " getChannel(), $method_field_name$, getCallOptions(), $params$);\n");
+ " getChannel(), $method_method_name$(), getCallOptions(), $params$);\n");
break;
case ASYNC_CALL:
if (server_streaming) {
@@ -682,7 +726,7 @@ static void PrintStub(
p->Print(
*vars,
"$last_line_prefix$$calls_method$(\n"
- " getChannel().newCall($method_field_name$, getCallOptions()), $params$);\n");
+ " getChannel().newCall($method_method_name$(), getCallOptions()), $params$);\n");
break;
case FUTURE_CALL:
GRPC_CODEGEN_CHECK(!client_streaming && !server_streaming)
@@ -693,7 +737,7 @@ static void PrintStub(
p->Print(
*vars,
"return $calls_method$(\n"
- " getChannel().newCall($method_field_name$, getCallOptions()), request);\n");
+ " getChannel().newCall($method_method_name$(), getCallOptions()), request);\n");
break;
}
}
@@ -1121,6 +1165,7 @@ void GenerateService(const ServiceDescriptor* service,
// avoid collision with generated classes.
std::map<string, string> vars;
vars["String"] = "java.lang.String";
+ vars["Deprecated"] = "java.lang.Deprecated";
vars["Override"] = "java.lang.Override";
vars["Channel"] = "io.grpc.Channel";
vars["CallOptions"] = "io.grpc.CallOptions";
diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt
index 4c01400f6..87ab55f9d 100644
--- a/compiler/src/test/golden/TestService.java.txt
+++ b/compiler/src/test/golden/TestService.java.txt
@@ -31,75 +31,165 @@ public final class TestServiceGrpc {
// 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.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.SimpleRequest, io.grpc.testing.integration.Test.SimpleResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "UnaryCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance()))
- .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("UnaryCall"))
- .build();
+ io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL = getUnaryCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
+ io.grpc.testing.integration.Test.SimpleResponse> getUnaryCallMethod;
+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
+ io.grpc.testing.integration.Test.SimpleResponse> getUnaryCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest, io.grpc.testing.integration.Test.SimpleResponse> getUnaryCallMethod;
+ if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
+ TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.SimpleRequest, io.grpc.testing.integration.Test.SimpleResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "UnaryCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("UnaryCall"))
+ .build();
+ }
+ }
+ }
+ return getUnaryCallMethod;
+ }
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getStreamingOutputCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "StreamingOutputCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
- .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("StreamingOutputCall"))
- .build();
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = getStreamingOutputCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
+ if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
+ TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "StreamingOutputCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("StreamingOutputCall"))
+ .build();
+ }
+ }
+ }
+ return getStreamingOutputCallMethod;
+ }
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getStreamingInputCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "StreamingInputCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()))
- .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("StreamingInputCall"))
- .build();
+ io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = getStreamingInputCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
+ if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
+ TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "StreamingInputCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("StreamingInputCall"))
+ .build();
+ }
+ }
+ }
+ return getStreamingInputCallMethod;
+ }
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getFullBidiCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "FullBidiCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
- .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("FullBidiCall"))
- .build();
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL = getFullBidiCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
+ if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
+ TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "FullBidiCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("FullBidiCall"))
+ .build();
+ }
+ }
+ }
+ return getFullBidiCallMethod;
+ }
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getHalfBidiCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "HalfBidiCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
- .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("HalfBidiCall"))
- .build();
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = getHalfBidiCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
+ if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
+ TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "HalfBidiCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("HalfBidiCall"))
+ .build();
+ }
+ }
+ }
+ return getHalfBidiCallMethod;
+ }
/**
* Creates a new async stub that supports all call types for the service
@@ -139,7 +229,7 @@ public final class TestServiceGrpc {
*/
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);
+ asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
}
/**
@@ -150,7 +240,7 @@ public final class TestServiceGrpc {
*/
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);
+ asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
}
/**
@@ -161,7 +251,7 @@ public final class TestServiceGrpc {
*/
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);
+ return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
}
/**
@@ -173,7 +263,7 @@ public final class TestServiceGrpc {
*/
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);
+ return asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
}
/**
@@ -186,7 +276,7 @@ public final class TestServiceGrpc {
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
- return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
+ return asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
@@ -260,7 +350,7 @@ public final class TestServiceGrpc {
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnaryCall(
- getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
+ getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
@@ -272,7 +362,7 @@ public final class TestServiceGrpc {
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
- getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
+ getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
}
/**
@@ -284,7 +374,7 @@ public final class TestServiceGrpc {
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
- getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
}
/**
@@ -297,7 +387,7 @@ public final class TestServiceGrpc {
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
- getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
}
/**
@@ -311,7 +401,7 @@ public final class TestServiceGrpc {
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
- getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
}
}
@@ -344,7 +434,7 @@ public final class TestServiceGrpc {
*/
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
return blockingUnaryCall(
- getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
+ getChannel(), getUnaryCallMethod(), getCallOptions(), request);
}
/**
@@ -356,7 +446,7 @@ public final class TestServiceGrpc {
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
- getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
+ getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
}
}
@@ -390,7 +480,7 @@ public final class TestServiceGrpc {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request) {
return futureUnaryCall(
- getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
+ getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
}
}
diff --git a/compiler/src/testLite/golden/TestService.java.txt b/compiler/src/testLite/golden/TestService.java.txt
index 555c1986e..1bd0e7483 100644
--- a/compiler/src/testLite/golden/TestService.java.txt
+++ b/compiler/src/testLite/golden/TestService.java.txt
@@ -31,70 +31,160 @@ public final class TestServiceGrpc {
// 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.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.SimpleRequest, io.grpc.testing.integration.Test.SimpleResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "UnaryCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance()))
- .build();
+ io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL = getUnaryCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
+ io.grpc.testing.integration.Test.SimpleResponse> getUnaryCallMethod;
+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
+ io.grpc.testing.integration.Test.SimpleResponse> getUnaryCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest, io.grpc.testing.integration.Test.SimpleResponse> getUnaryCallMethod;
+ if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
+ TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.SimpleRequest, io.grpc.testing.integration.Test.SimpleResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "UnaryCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance()))
+ .build();
+ }
+ }
+ }
+ return getUnaryCallMethod;
+ }
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getStreamingOutputCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "StreamingOutputCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
- .build();
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = getStreamingOutputCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
+ if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
+ TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "StreamingOutputCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
+ .build();
+ }
+ }
+ }
+ return getStreamingOutputCallMethod;
+ }
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getStreamingInputCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "StreamingInputCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()))
- .build();
+ io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = getStreamingInputCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
+ if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
+ TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "StreamingInputCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()))
+ .build();
+ }
+ }
+ }
+ return getStreamingInputCallMethod;
+ }
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getFullBidiCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "FullBidiCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
- .build();
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL = getFullBidiCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
+ if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
+ TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "FullBidiCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
+ .build();
+ }
+ }
+ }
+ return getFullBidiCallMethod;
+ }
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getHalfBidiCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "HalfBidiCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
- .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
- io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
- .build();
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = getHalfBidiCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
+ if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
+ TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingOutputCallRequest, io.grpc.testing.integration.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "HalfBidiCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()))
+ .build();
+ }
+ }
+ }
+ return getHalfBidiCallMethod;
+ }
/**
* Creates a new async stub that supports all call types for the service
@@ -134,7 +224,7 @@ public final class TestServiceGrpc {
*/
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);
+ asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
}
/**
@@ -145,7 +235,7 @@ public final class TestServiceGrpc {
*/
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);
+ asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
}
/**
@@ -156,7 +246,7 @@ public final class TestServiceGrpc {
*/
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);
+ return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
}
/**
@@ -168,7 +258,7 @@ public final class TestServiceGrpc {
*/
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);
+ return asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
}
/**
@@ -181,7 +271,7 @@ public final class TestServiceGrpc {
*/
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
- return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
+ return asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
@@ -255,7 +345,7 @@ public final class TestServiceGrpc {
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnaryCall(
- getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
+ getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
@@ -267,7 +357,7 @@ public final class TestServiceGrpc {
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
- getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
+ getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
}
/**
@@ -279,7 +369,7 @@ public final class TestServiceGrpc {
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
- getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
}
/**
@@ -292,7 +382,7 @@ public final class TestServiceGrpc {
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
- getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
}
/**
@@ -306,7 +396,7 @@ public final class TestServiceGrpc {
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncBidiStreamingCall(
- getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
}
}
@@ -339,7 +429,7 @@ public final class TestServiceGrpc {
*/
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
return blockingUnaryCall(
- getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
+ getChannel(), getUnaryCallMethod(), getCallOptions(), request);
}
/**
@@ -351,7 +441,7 @@ public final class TestServiceGrpc {
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
- getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
+ getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
}
}
@@ -385,7 +475,7 @@ public final class TestServiceGrpc {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request) {
return futureUnaryCall(
- getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
+ getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
}
}
diff --git a/compiler/src/testNano/golden/TestService.java.txt b/compiler/src/testNano/golden/TestService.java.txt
index 626ea13d5..dd51f1fcc 100644
--- a/compiler/src/testNano/golden/TestService.java.txt
+++ b/compiler/src/testNano/golden/TestService.java.txt
@@ -35,78 +35,168 @@ public final class TestServiceGrpc {
private static final int ARG_IN_METHOD_UNARY_CALL = 0;
private static final int ARG_OUT_METHOD_UNARY_CALL = 1;
@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.testing.integration.nano.Test.SimpleRequest,
- io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.SimpleRequest, io.grpc.testing.integration.nano.Test.SimpleResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "UnaryCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)))
- .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL)))
- .build();
+ io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL = getUnaryCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
+ io.grpc.testing.integration.nano.Test.SimpleResponse> getUnaryCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
+ io.grpc.testing.integration.nano.Test.SimpleResponse> getUnaryCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest, io.grpc.testing.integration.nano.Test.SimpleResponse> getUnaryCallMethod;
+ if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
+ TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.SimpleRequest, io.grpc.testing.integration.nano.Test.SimpleResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "UnaryCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)))
+ .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL)))
+ .build();
+ }
+ }
+ }
+ return getUnaryCallMethod;
+ }
private static final int ARG_IN_METHOD_STREAMING_OUTPUT_CALL = 2;
private static final int ARG_OUT_METHOD_STREAMING_OUTPUT_CALL = 3;
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getStreamingOutputCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "StreamingOutputCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)))
- .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL)))
- .build();
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = getStreamingOutputCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
+ if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
+ TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "StreamingOutputCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)))
+ .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL)))
+ .build();
+ }
+ }
+ }
+ return getStreamingOutputCallMethod;
+ }
private static final int ARG_IN_METHOD_STREAMING_INPUT_CALL = 4;
private static final int ARG_OUT_METHOD_STREAMING_INPUT_CALL = 5;
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getStreamingInputCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest, io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "StreamingInputCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)))
- .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL)))
- .build();
+ io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = getStreamingInputCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest, io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
+ if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
+ TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest, io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "StreamingInputCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)))
+ .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL)))
+ .build();
+ }
+ }
+ }
+ return getStreamingInputCallMethod;
+ }
private static final int ARG_IN_METHOD_FULL_BIDI_CALL = 6;
private static final int ARG_OUT_METHOD_FULL_BIDI_CALL = 7;
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getFullBidiCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "FullBidiCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)))
- .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL)))
- .build();
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL = getFullBidiCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
+ if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
+ TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "FullBidiCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)))
+ .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL)))
+ .build();
+ }
+ }
+ }
+ return getFullBidiCallMethod;
+ }
private static final int ARG_IN_METHOD_HALF_BIDI_CALL = 8;
private static final int ARG_OUT_METHOD_HALF_BIDI_CALL = 9;
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ @java.lang.Deprecated // Use {@link getHalfBidiCallMethod()} instead.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
- io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>newBuilder()
- .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
- .setFullMethodName(generateFullMethodName(
- "grpc.testing.TestService", "HalfBidiCall"))
- .setRegisterForTracing(true)
- .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)))
- .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
- new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL)))
- .build();
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = getHalfBidiCallMethod();
+
+ private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
+
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
+ public static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
+ io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
+ if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
+ synchronized (TestServiceGrpc.class) {
+ if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
+ TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod =
+ io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest, io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(
+ "grpc.testing.TestService", "HalfBidiCall"))
+ .setRegisterForTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)))
+ .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
+ new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL)))
+ .build();
+ }
+ }
+ }
+ return getHalfBidiCallMethod;
+ }
private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
@@ -197,7 +287,7 @@ public final class TestServiceGrpc {
*/
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);
+ asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
}
/**
@@ -208,7 +298,7 @@ public final class TestServiceGrpc {
*/
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);
+ asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
}
/**
@@ -219,7 +309,7 @@ public final class TestServiceGrpc {
*/
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);
+ return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
}
/**
@@ -231,7 +321,7 @@ public final class TestServiceGrpc {
*/
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);
+ return asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
}
/**
@@ -244,7 +334,7 @@ public final class TestServiceGrpc {
*/
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) {
- return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
+ return asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
@@ -318,7 +408,7 @@ public final class TestServiceGrpc {
public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
asyncUnaryCall(
- getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
+ getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
}
/**
@@ -330,7 +420,7 @@ public final class TestServiceGrpc {
public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
- getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
+ getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
}
/**
@@ -342,7 +432,7 @@ public final class TestServiceGrpc {
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 asyncClientStreamingCall(
- getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
}
/**
@@ -355,7 +445,7 @@ public final class TestServiceGrpc {
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 asyncBidiStreamingCall(
- getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
}
/**
@@ -369,7 +459,7 @@ public final class TestServiceGrpc {
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) {
return asyncBidiStreamingCall(
- getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
+ getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
}
}
@@ -402,7 +492,7 @@ public final class TestServiceGrpc {
*/
public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
return blockingUnaryCall(
- getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
+ getChannel(), getUnaryCallMethod(), getCallOptions(), request);
}
/**
@@ -414,7 +504,7 @@ public final class TestServiceGrpc {
public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
- getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
+ getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
}
}
@@ -448,7 +538,7 @@ public final class TestServiceGrpc {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.nano.Test.SimpleRequest request) {
return futureUnaryCall(
- getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
+ getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
}
}