diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
index d68d85eb0cd..8c934f24f3e 100644
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -79,14 +79,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- include:
- # Test with and without bzlmod. Bazel 6 doesn't support bzlmod, so use Bazel 7 instead
- - bazel: 6.0.0
- bzlmod: false
- - bazel: 7.0.0
- bzlmod: true
+ bzlmod: [true, false]
env:
- USE_BAZEL_VERSION: ${{ matrix.bazel }}
+ USE_BAZEL_VERSION: 7.0.0
steps:
- uses: actions/checkout@v4
diff --git a/MODULE.bazel b/MODULE.bazel
index edb5284a23d..4c7e1b3dca5 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -2,7 +2,7 @@ module(
name = "grpc-java",
compatibility_level = 0,
repo_name = "io_grpc_grpc_java",
- version = "1.70.0-SNAPSHOT", # CURRENT_GRPC_VERSION
+ version = "1.71.0-SNAPSHOT", # CURRENT_GRPC_VERSION
)
# GRPC_DEPS_START
diff --git a/README.md b/README.md
index 97b2bd6d5f9..c6a8f3bdd8a 100644
--- a/README.md
+++ b/README.md
@@ -44,8 +44,8 @@ For a guided tour, take a look at the [quick start
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
basics](https://grpc.io/docs/languages/java/basics).
-The [examples](https://github.com/grpc/grpc-java/tree/v1.68.1/examples) and the
-[Android example](https://github.com/grpc/grpc-java/tree/v1.68.1/examples/android)
+The [examples](https://github.com/grpc/grpc-java/tree/v1.69.0/examples) and the
+[Android example](https://github.com/grpc/grpc-java/tree/v1.69.0/examples/android)
are standalone projects that showcase the usage of gRPC.
Download
@@ -56,18 +56,18 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
io.grpcgrpc-netty-shaded
- 1.68.1
+ 1.69.0runtimeio.grpcgrpc-protobuf
- 1.68.1
+ 1.69.0io.grpcgrpc-stub
- 1.68.1
+ 1.69.0org.apache.tomcat
@@ -79,18 +79,18 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
Or for Gradle with non-Android, add to your dependencies:
```gradle
-runtimeOnly 'io.grpc:grpc-netty-shaded:1.68.1'
-implementation 'io.grpc:grpc-protobuf:1.68.1'
-implementation 'io.grpc:grpc-stub:1.68.1'
+runtimeOnly 'io.grpc:grpc-netty-shaded:1.69.0'
+implementation 'io.grpc:grpc-protobuf:1.69.0'
+implementation 'io.grpc:grpc-stub:1.69.0'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```
For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
`grpc-protobuf-lite` instead of `grpc-protobuf`:
```gradle
-implementation 'io.grpc:grpc-okhttp:1.68.1'
-implementation 'io.grpc:grpc-protobuf-lite:1.68.1'
-implementation 'io.grpc:grpc-stub:1.68.1'
+implementation 'io.grpc:grpc-okhttp:1.69.0'
+implementation 'io.grpc:grpc-protobuf-lite:1.69.0'
+implementation 'io.grpc:grpc-stub:1.69.0'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```
@@ -99,7 +99,7 @@ For [Bazel](https://bazel.build), you can either
(with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below).
[the JARs]:
-https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.68.1
+https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.69.0
Development snapshots are available in [Sonatypes's snapshot
repository](https://oss.sonatype.org/content/repositories/snapshots/).
@@ -131,7 +131,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}grpc-java
- io.grpc:protoc-gen-grpc-java:1.68.1:exe:${os.detected.classifier}
+ io.grpc:protoc-gen-grpc-java:1.69.0:exe:${os.detected.classifier}
@@ -161,7 +161,7 @@ protobuf {
}
plugins {
grpc {
- artifact = 'io.grpc:protoc-gen-grpc-java:1.68.1'
+ artifact = 'io.grpc:protoc-gen-grpc-java:1.69.0'
}
}
generateProtoTasks {
@@ -194,7 +194,7 @@ protobuf {
}
plugins {
grpc {
- artifact = 'io.grpc:protoc-gen-grpc-java:1.68.1'
+ artifact = 'io.grpc:protoc-gen-grpc-java:1.69.0'
}
}
generateProtoTasks {
diff --git a/alts/BUILD.bazel b/alts/BUILD.bazel
index 73420e11053..3595064ffa4 100644
--- a/alts/BUILD.bazel
+++ b/alts/BUILD.bazel
@@ -18,6 +18,7 @@ java_library(
"@com_google_protobuf//:protobuf_java",
"@com_google_protobuf//:protobuf_java_util",
artifact("com.google.code.findbugs:jsr305"),
+ artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("io.netty:netty-buffer"),
artifact("io.netty:netty-codec"),
diff --git a/alts/build.gradle b/alts/build.gradle
index de93c90546f..3e472d9cea6 100644
--- a/alts/build.gradle
+++ b/alts/build.gradle
@@ -44,7 +44,11 @@ dependencies {
classifier = "linux-x86_64"
}
}
- signature libraries.signature.java
+ signature (libraries.signature.java) {
+ artifact {
+ extension = "signature"
+ }
+ }
}
configureProtoCompilation()
diff --git a/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java b/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java
index 2caba4a0544..91e88f331d7 100644
--- a/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java
+++ b/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java
@@ -60,6 +60,21 @@ public HandshakerServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOption
return HandshakerServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static HandshakerServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HandshakerServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HandshakerServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return HandshakerServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -157,6 +172,40 @@ public io.grpc.stub.StreamObserver doHandsh
/**
* A stub to allow clients to do synchronous rpc calls to service HandshakerService.
*/
+ public static final class HandshakerServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private HandshakerServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HandshakerServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HandshakerServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * Handshaker service accepts a stream of handshaker request, returning a
+ * stream of handshaker response. Client is expected to send exactly one
+ * message with either client_start or server_start followed by one or more
+ * messages with next. Each time client sends a request, the handshaker
+ * service expects to respond. Client does not have to wait for service's
+ * response before sending next request.
+ *
+ */
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
+ public io.grpc.stub.BlockingClientCall
+ doHandshake() {
+ return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
+ getChannel(), getDoHandshakeMethod(), getCallOptions());
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service HandshakerService.
+ */
public static final class HandshakerServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private HandshakerServiceBlockingStub(
diff --git a/alts/src/main/java/io/grpc/alts/internal/AsyncSemaphore.java b/alts/src/main/java/io/grpc/alts/internal/AsyncSemaphore.java
index 3ccdcfc763a..a8251c7fbd3 100644
--- a/alts/src/main/java/io/grpc/alts/internal/AsyncSemaphore.java
+++ b/alts/src/main/java/io/grpc/alts/internal/AsyncSemaphore.java
@@ -16,12 +16,12 @@
package io.grpc.alts.internal;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import java.util.LinkedList;
import java.util.Queue;
-import javax.annotation.concurrent.GuardedBy;
/** Provides a semaphore primitive, without blocking waiting on permits. */
final class AsyncSemaphore {
diff --git a/android-interop-testing/build.gradle b/android-interop-testing/build.gradle
index 9b3b021afce..1d39aee1750 100644
--- a/android-interop-testing/build.gradle
+++ b/android-interop-testing/build.gradle
@@ -7,7 +7,6 @@ description = 'gRPC: Android Integration Testing'
repositories {
google()
- mavenCentral()
}
android {
diff --git a/android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/LoadBalancerStatsServiceGrpc.java b/android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/LoadBalancerStatsServiceGrpc.java
index e030fde13e3..120033a8051 100644
--- a/android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/LoadBalancerStatsServiceGrpc.java
+++ b/android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/LoadBalancerStatsServiceGrpc.java
@@ -92,6 +92,21 @@ public LoadBalancerStatsServiceStub newStub(io.grpc.Channel channel, io.grpc.Cal
return LoadBalancerStatsServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static LoadBalancerStatsServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public LoadBalancerStatsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return LoadBalancerStatsServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -212,6 +227,46 @@ public void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadB
* A service used to obtain stats for verifying LB behavior.
*
*/
+ public static final class LoadBalancerStatsServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private LoadBalancerStatsServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected LoadBalancerStatsServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * Gets the backend distribution for RPCs sent by a test client.
+ *
+ * One request followed by one response. Response has cache control
+ * headers set such that a caching HTTP proxy (such as GFE) can
+ * satisfy subsequent requests.
+ *
+ * A sequence of requests with each request served by the server immediately.
+ * As one request could lead to multiple responses, this interface
+ * demonstrates the idea of full duplexing.
+ *
+ * A sequence of requests followed by a sequence of responses.
+ * The server buffers all the client requests and then serves them in order. A
+ * stream of responses are returned to the client when the server starts with
+ * first request.
+ *
+ * One request followed by one response. Response has cache control
+ * headers set such that a caching HTTP proxy (such as GFE) can
+ * satisfy subsequent requests.
+ *
+ * A sequence of requests with each request served by the server immediately.
+ * As one request could lead to multiple responses, this interface
+ * demonstrates the idea of full duplexing.
+ *
+ * A sequence of requests followed by a sequence of responses.
+ * The server buffers all the client requests and then serves them in order. A
+ * stream of responses are returned to the client when the server starts with
+ * first request.
+ *
+ * The test server will not implement this method. It will be used
+ * to test the behavior when clients call unimplemented methods.
+ *
+ */
+ public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service TestService.
+ *
+ * A simple service to test the various types of RPCs and experiment with
+ * performance with various types of payload.
+ *
+ */
public static final class TestServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private TestServiceBlockingStub(
diff --git a/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java b/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java
index 743d68c3828..f758c2d0840 100644
--- a/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java
+++ b/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java
@@ -63,6 +63,21 @@ public UnimplementedServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOpt
return UnimplementedServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static UnimplementedServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public UnimplementedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return UnimplementedServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -166,6 +181,37 @@ public void unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty requ
* that case.
*
*/
+ public static final class UnimplementedServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private UnimplementedServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected UnimplementedServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * A call that no server should implement
+ *
+ */
+ public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service UnimplementedService.
+ *
+ * A simple service NOT implemented at servers so clients can test for
+ * that case.
+ *
+ */
public static final class UnimplementedServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private UnimplementedServiceBlockingStub(
diff --git a/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateClientConfigureServiceGrpc.java b/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateClientConfigureServiceGrpc.java
index 61cfc19d29b..5fa43e4721a 100644
--- a/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateClientConfigureServiceGrpc.java
+++ b/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateClientConfigureServiceGrpc.java
@@ -62,6 +62,21 @@ public XdsUpdateClientConfigureServiceStub newStub(io.grpc.Channel channel, io.g
return XdsUpdateClientConfigureServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static XdsUpdateClientConfigureServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public XdsUpdateClientConfigureServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return XdsUpdateClientConfigureServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -161,6 +176,36 @@ public void configure(io.grpc.testing.integration.Messages.ClientConfigureReques
* A service to dynamically update the configuration of an xDS test client.
*
*/
+ public static final class XdsUpdateClientConfigureServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private XdsUpdateClientConfigureServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected XdsUpdateClientConfigureServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * Update the tes client's configuration.
+ *
+ */
+ public io.grpc.testing.integration.Messages.ClientConfigureResponse configure(io.grpc.testing.integration.Messages.ClientConfigureRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getConfigureMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service XdsUpdateClientConfigureService.
+ *
+ * A service to dynamically update the configuration of an xDS test client.
+ *
+ */
public static final class XdsUpdateClientConfigureServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private XdsUpdateClientConfigureServiceBlockingStub(
diff --git a/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateHealthServiceGrpc.java b/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateHealthServiceGrpc.java
index 6ba9419dedf..2492ec0f90b 100644
--- a/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateHealthServiceGrpc.java
+++ b/android-interop-testing/src/generated/release/grpc/io/grpc/testing/integration/XdsUpdateHealthServiceGrpc.java
@@ -92,6 +92,21 @@ public XdsUpdateHealthServiceStub newStub(io.grpc.Channel channel, io.grpc.CallO
return XdsUpdateHealthServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static XdsUpdateHealthServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public XdsUpdateHealthServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return XdsUpdateHealthServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -200,6 +215,40 @@ public void setNotServing(io.grpc.testing.integration.EmptyProtos.Empty request,
* A service to remotely control health status of an xDS test server.
*
*/
+ public static final class XdsUpdateHealthServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private XdsUpdateHealthServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected XdsUpdateHealthServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ */
+ public io.grpc.testing.integration.EmptyProtos.Empty setServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getSetServingMethod(), getCallOptions(), request);
+ }
+
+ /**
+ */
+ public io.grpc.testing.integration.EmptyProtos.Empty setNotServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getSetNotServingMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service XdsUpdateHealthService.
+ *
+ * A service to remotely control health status of an xDS test server.
+ *
+ */
public static final class XdsUpdateHealthServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private XdsUpdateHealthServiceBlockingStub(
diff --git a/android/build.gradle b/android/build.gradle
index 3b3bfa59b96..3c717da18a3 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -31,7 +31,6 @@ android {
repositories {
google()
- mavenCentral()
}
dependencies {
diff --git a/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java b/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java
index 317b7a50b74..e56ce5fc405 100644
--- a/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java
+++ b/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java
@@ -28,6 +28,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.InlineMe;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.CallOptions;
import io.grpc.ClientCall;
import io.grpc.ConnectivityState;
@@ -41,7 +42,6 @@
import io.grpc.internal.GrpcUtil;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
/**
* Builds a {@link ManagedChannel} that, when provided with a {@link Context}, will automatically
diff --git a/api/BUILD.bazel b/api/BUILD.bazel
index 6bf3375e9f0..965d14a9eb0 100644
--- a/api/BUILD.bazel
+++ b/api/BUILD.bazel
@@ -6,7 +6,6 @@ java_library(
"src/main/java/**/*.java",
"src/context/java/**/*.java",
]),
- javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final
visibility = ["//visibility:public"],
deps = [
artifact("com.google.code.findbugs:jsr305"),
diff --git a/api/build.gradle b/api/build.gradle
index 1d21c7bdcb6..dc3eaea3f4e 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -48,8 +48,20 @@ dependencies {
testImplementation project(':grpc-testing')
testImplementation libraries.guava.testlib
- signature libraries.signature.java
- signature libraries.signature.android
+ signature (libraries.signature.java) {
+ artifact {
+ extension = "signature"
+ }
+ }
+ signature (libraries.signature.android) {
+ artifact {
+ extension = "signature"
+ }
+ }
+}
+
+animalsniffer {
+ annotation = 'io.grpc.IgnoreJRERequirement'
}
tasks.named("javadoc").configure {
diff --git a/api/src/main/java/io/grpc/CallOptions.java b/api/src/main/java/io/grpc/CallOptions.java
index a1b8984c48b..800bdfb6c90 100644
--- a/api/src/main/java/io/grpc/CallOptions.java
+++ b/api/src/main/java/io/grpc/CallOptions.java
@@ -21,6 +21,7 @@
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
+import com.google.errorprone.annotations.CheckReturnValue;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,7 +29,6 @@
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
-import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
diff --git a/api/src/main/java/io/grpc/ConfiguratorRegistry.java b/api/src/main/java/io/grpc/ConfiguratorRegistry.java
index b2efcc1cff4..a0a91609dde 100644
--- a/api/src/main/java/io/grpc/ConfiguratorRegistry.java
+++ b/api/src/main/java/io/grpc/ConfiguratorRegistry.java
@@ -16,10 +16,10 @@
package io.grpc;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import javax.annotation.concurrent.GuardedBy;
/**
* A registry for {@link Configurator} instances.
diff --git a/api/src/main/java/io/grpc/ForwardingChannelBuilder2.java b/api/src/main/java/io/grpc/ForwardingChannelBuilder2.java
index 7f21a57ec80..78fe730d91a 100644
--- a/api/src/main/java/io/grpc/ForwardingChannelBuilder2.java
+++ b/api/src/main/java/io/grpc/ForwardingChannelBuilder2.java
@@ -263,6 +263,12 @@ protected T addMetricSink(MetricSink metricSink) {
return thisT();
}
+ @Override
+ public T setNameResolverArg(NameResolver.Args.Key key, X value) {
+ delegate().setNameResolverArg(key, value);
+ return thisT();
+ }
+
/**
* Returns the {@link ManagedChannel} built by the delegate by default. Overriding method can
* return different value.
diff --git a/api/src/main/java/io/grpc/IgnoreJRERequirement.java b/api/src/main/java/io/grpc/IgnoreJRERequirement.java
new file mode 100644
index 00000000000..2db406c5953
--- /dev/null
+++ b/api/src/main/java/io/grpc/IgnoreJRERequirement.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2024 The gRPC Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.grpc;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * Disables Animal Sniffer's signature checking. This is our own package-private version to avoid
+ * dependening on animalsniffer-annotations.
+ *
+ *
FIELD is purposefully not supported, as Android wouldn't be able to ignore a field. Instead,
+ * the entire class would need to be avoided on Android.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
+@interface IgnoreJRERequirement {}
diff --git a/api/src/main/java/io/grpc/InternalStatus.java b/api/src/main/java/io/grpc/InternalStatus.java
index b6549bb435f..56df1decf38 100644
--- a/api/src/main/java/io/grpc/InternalStatus.java
+++ b/api/src/main/java/io/grpc/InternalStatus.java
@@ -38,12 +38,11 @@ private InternalStatus() {}
public static final Metadata.Key CODE_KEY = Status.CODE_KEY;
/**
- * Create a new {@link StatusRuntimeException} with the internal option of skipping the filling
- * of the stack trace.
+ * Create a new {@link StatusRuntimeException} skipping the filling of the stack trace.
*/
@Internal
- public static final StatusRuntimeException asRuntimeException(Status status,
- @Nullable Metadata trailers, boolean fillInStackTrace) {
- return new StatusRuntimeException(status, trailers, fillInStackTrace);
+ public static StatusRuntimeException asRuntimeExceptionWithoutStacktrace(Status status,
+ @Nullable Metadata trailers) {
+ return new InternalStatusRuntimeException(status, trailers);
}
}
diff --git a/api/src/main/java/io/grpc/InternalStatusRuntimeException.java b/api/src/main/java/io/grpc/InternalStatusRuntimeException.java
new file mode 100644
index 00000000000..6090b701f0b
--- /dev/null
+++ b/api/src/main/java/io/grpc/InternalStatusRuntimeException.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 The gRPC Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.grpc;
+
+import javax.annotation.Nullable;
+
+/**
+ * StatusRuntimeException without stack trace, implemented as a subclass, as the
+ * {@code String, Throwable, boolean, boolean} constructor is not available in the supported
+ * version of Android.
+ *
+ * @see StatusRuntimeException
+ */
+class InternalStatusRuntimeException extends StatusRuntimeException {
+ private static final long serialVersionUID = 0;
+
+ public InternalStatusRuntimeException(Status status, @Nullable Metadata trailers) {
+ super(status, trailers);
+ }
+
+ @Override
+ public synchronized Throwable fillInStackTrace() {
+ return this;
+ }
+}
diff --git a/api/src/main/java/io/grpc/ManagedChannelBuilder.java b/api/src/main/java/io/grpc/ManagedChannelBuilder.java
index 6e30d8eae04..df867d09ba1 100644
--- a/api/src/main/java/io/grpc/ManagedChannelBuilder.java
+++ b/api/src/main/java/io/grpc/ManagedChannelBuilder.java
@@ -633,6 +633,23 @@ protected T addMetricSink(MetricSink metricSink) {
throw new UnsupportedOperationException();
}
+ /**
+ * Provides a "custom" argument for the {@link NameResolver}, if applicable, replacing any 'value'
+ * previously provided for 'key'.
+ *
+ *
NB: If the selected {@link NameResolver} does not understand 'key', or target URI resolution
+ * isn't needed at all, your custom argument will be silently ignored.
+ *
+ *
See {@link NameResolver.Args#getArg(NameResolver.Args.Key)} for more.
+ *
+ * @param key identifies the argument in a type-safe manner
+ * @param value the argument itself
+ * @return this
+ */
+ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
+ public T setNameResolverArg(NameResolver.Args.Key key, X value) {
+ throw new UnsupportedOperationException();
+ }
/**
* Builds a channel using the given parameters.
diff --git a/api/src/main/java/io/grpc/ManagedChannelRegistry.java b/api/src/main/java/io/grpc/ManagedChannelRegistry.java
index 3d0b1647bda..fc9e693b560 100644
--- a/api/src/main/java/io/grpc/ManagedChannelRegistry.java
+++ b/api/src/main/java/io/grpc/ManagedChannelRegistry.java
@@ -18,6 +18,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.net.SocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
@@ -30,7 +31,6 @@
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
diff --git a/api/src/main/java/io/grpc/MethodDescriptor.java b/api/src/main/java/io/grpc/MethodDescriptor.java
index 1bfaccb4201..a02eb840deb 100644
--- a/api/src/main/java/io/grpc/MethodDescriptor.java
+++ b/api/src/main/java/io/grpc/MethodDescriptor.java
@@ -20,9 +20,9 @@
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
+import com.google.errorprone.annotations.CheckReturnValue;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicReferenceArray;
-import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
diff --git a/api/src/main/java/io/grpc/MetricInstrumentRegistry.java b/api/src/main/java/io/grpc/MetricInstrumentRegistry.java
index a61ac058a61..1b33ed17a71 100644
--- a/api/src/main/java/io/grpc/MetricInstrumentRegistry.java
+++ b/api/src/main/java/io/grpc/MetricInstrumentRegistry.java
@@ -21,12 +21,12 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import javax.annotation.concurrent.GuardedBy;
/**
* A registry for globally registered metric instruments.
diff --git a/api/src/main/java/io/grpc/NameResolver.java b/api/src/main/java/io/grpc/NameResolver.java
index b35601289a3..e8295365ca8 100644
--- a/api/src/main/java/io/grpc/NameResolver.java
+++ b/api/src/main/java/io/grpc/NameResolver.java
@@ -28,11 +28,13 @@
import java.lang.annotation.RetentionPolicy;
import java.net.URI;
import java.util.Collections;
+import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
+import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;
/**
@@ -276,7 +278,12 @@ public Status onResult2(ResolutionResult resolutionResult) {
/**
* Information that a {@link Factory} uses to create a {@link NameResolver}.
*
- *
Note this class doesn't override neither {@code equals()} nor {@code hashCode()}.
+ *
Args applicable to all {@link NameResolver}s are defined here using ordinary setters and
+ * getters. This container can also hold externally-defined "custom" args that aren't so widely
+ * useful or that would be inappropriate dependencies for this low level API. See {@link
+ * Args#getArg} for more.
+ *
+ *
TODO: Only meaningful for InetSocketAddress producers. Make this a custom arg?
public int getDefaultPort() {
return defaultPort;
}
@@ -371,6 +373,30 @@ public ServiceConfigParser getServiceConfigParser() {
return serviceConfigParser;
}
+ /**
+ * Returns the value of a custom arg named 'key', or {@code null} if it's not set.
+ *
+ *
While ordinary {@link Args} should be universally useful and meaningful, custom arguments
+ * can apply just to resolvers of a certain URI scheme, just to resolvers producing a particular
+ * type of {@link java.net.SocketAddress}, or even an individual {@link NameResolver} subclass.
+ * Custom args are identified by an instance of {@link Args.Key} which should be a constant
+ * defined in a java package and class appropriate for the argument's scope.
+ *
+ *
{@link Args} are normally reserved for information in *support* of name resolution, not
+ * the name to be resolved itself. However, there are rare cases where all or part of the target
+ * name can't be represented by any standard URI scheme or can't be encoded as a String at all.
+ * Custom args, in contrast, can hold arbitrary Java types, making them a useful work around in
+ * these cases.
+ *
+ *
Custom args can also be used simply to avoid adding inappropriate deps to the low level
+ * io.grpc package.
+ */
+ @SuppressWarnings("unchecked") // Cast is safe because all put()s go through the setArg() API.
+ @Nullable
+ public T getArg(Key key) {
+ return customArgs != null ? (T) customArgs.get(key) : null;
+ }
+
/**
* Returns the {@link ChannelLogger} for the Channel served by this NameResolver.
*
@@ -424,6 +450,7 @@ public String toString() {
.add("proxyDetector", proxyDetector)
.add("syncContext", syncContext)
.add("serviceConfigParser", serviceConfigParser)
+ .add("customArgs", customArgs)
.add("scheduledExecutorService", scheduledExecutorService)
.add("channelLogger", channelLogger)
.add("executor", executor)
@@ -448,6 +475,7 @@ public Builder toBuilder() {
builder.setOffloadExecutor(executor);
builder.setOverrideAuthority(overrideAuthority);
builder.setMetricRecorder(metricRecorder);
+ builder.customArgs = cloneCustomArgs(customArgs);
return builder;
}
@@ -475,6 +503,7 @@ public static final class Builder {
private Executor executor;
private String overrideAuthority;
private MetricRecorder metricRecorder;
+ private IdentityHashMap, Object> customArgs;
Builder() {
}
@@ -561,6 +590,17 @@ public Builder setOverrideAuthority(String authority) {
return this;
}
+ /** See {@link Args#getArg(Key)}. */
+ public Builder setArg(Key key, T value) {
+ checkNotNull(key, "key");
+ checkNotNull(value, "value");
+ if (customArgs == null) {
+ customArgs = new IdentityHashMap<>();
+ }
+ customArgs.put(key, value);
+ return this;
+ }
+
/**
* See {@link Args#getMetricRecorder()}. This is an optional field.
*/
@@ -575,11 +615,40 @@ public Builder setMetricRecorder(MetricRecorder metricRecorder) {
* @since 1.21.0
*/
public Args build() {
- return
- new Args(
- defaultPort, proxyDetector, syncContext, serviceConfigParser,
- scheduledExecutorService, channelLogger, executor, overrideAuthority,
- metricRecorder);
+ return new Args(this);
+ }
+ }
+
+ /**
+ * Identifies an externally-defined custom argument that can be stored in {@link Args}.
+ *
+ *
Uses reference equality so keys should be defined as global constants.
+ *
+ * @param type of values that can be stored under this key
+ */
+ @Immutable
+ @SuppressWarnings("UnusedTypeParameter")
+ public static final class Key {
+ private final String debugString;
+
+ private Key(String debugString) {
+ this.debugString = debugString;
+ }
+
+ @Override
+ public String toString() {
+ return debugString;
+ }
+
+ /**
+ * Creates a new instance of {@link Key}.
+ *
+ * @param debugString a string used to describe the key, used for debugging.
+ * @param Key type
+ * @return a new instance of Key
+ */
+ public static Key create(String debugString) {
+ return new Key<>(debugString);
}
}
}
@@ -877,4 +946,10 @@ public String toString() {
}
}
}
+
+ @Nullable
+ private static IdentityHashMap, Object> cloneCustomArgs(
+ @Nullable IdentityHashMap, Object> customArgs) {
+ return customArgs != null ? new IdentityHashMap<>(customArgs) : null;
+ }
}
diff --git a/api/src/main/java/io/grpc/NameResolverRegistry.java b/api/src/main/java/io/grpc/NameResolverRegistry.java
index 23eec23fd6a..2648f8de1aa 100644
--- a/api/src/main/java/io/grpc/NameResolverRegistry.java
+++ b/api/src/main/java/io/grpc/NameResolverRegistry.java
@@ -20,6 +20,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
@@ -31,7 +32,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
diff --git a/api/src/main/java/io/grpc/ServerRegistry.java b/api/src/main/java/io/grpc/ServerRegistry.java
index a083e45a000..5b9c8c558e7 100644
--- a/api/src/main/java/io/grpc/ServerRegistry.java
+++ b/api/src/main/java/io/grpc/ServerRegistry.java
@@ -18,6 +18,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -25,7 +26,6 @@
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
diff --git a/api/src/main/java/io/grpc/Status.java b/api/src/main/java/io/grpc/Status.java
index 5d7dd30df01..38cd9581f8e 100644
--- a/api/src/main/java/io/grpc/Status.java
+++ b/api/src/main/java/io/grpc/Status.java
@@ -23,6 +23,7 @@
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.Metadata.TrustedAsciiMarshaller;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -30,7 +31,6 @@
import java.util.Collections;
import java.util.List;
import java.util.TreeMap;
-import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
diff --git a/api/src/main/java/io/grpc/StatusException.java b/api/src/main/java/io/grpc/StatusException.java
index b719f881132..f9416bf72e3 100644
--- a/api/src/main/java/io/grpc/StatusException.java
+++ b/api/src/main/java/io/grpc/StatusException.java
@@ -44,12 +44,7 @@ public StatusException(Status status) {
* @since 1.0.0
*/
public StatusException(Status status, @Nullable Metadata trailers) {
- this(status, trailers, /*fillInStackTrace=*/ true);
- }
-
- StatusException(Status status, @Nullable Metadata trailers, boolean fillInStackTrace) {
- super(Status.formatThrowableMessage(status), status.getCause(),
- /* enableSuppression */ true, /* writableStackTrace */fillInStackTrace);
+ super(Status.formatThrowableMessage(status), status.getCause());
this.status = status;
this.trailers = trailers;
}
diff --git a/api/src/main/java/io/grpc/StatusRuntimeException.java b/api/src/main/java/io/grpc/StatusRuntimeException.java
index 9465e4c38cd..dd22d6b2486 100644
--- a/api/src/main/java/io/grpc/StatusRuntimeException.java
+++ b/api/src/main/java/io/grpc/StatusRuntimeException.java
@@ -45,12 +45,7 @@ public StatusRuntimeException(Status status) {
* @since 1.0.0
*/
public StatusRuntimeException(Status status, @Nullable Metadata trailers) {
- this(status, trailers, /*fillInStackTrace=*/ true);
- }
-
- StatusRuntimeException(Status status, @Nullable Metadata trailers, boolean fillInStackTrace) {
- super(Status.formatThrowableMessage(status), status.getCause(),
- /* enable suppressions */ true, /* writableStackTrace */ fillInStackTrace);
+ super(Status.formatThrowableMessage(status), status.getCause());
this.status = status;
this.trailers = trailers;
}
diff --git a/api/src/main/java/io/grpc/TimeUtils.java b/api/src/main/java/io/grpc/TimeUtils.java
index c3031f13d94..01b8c158822 100644
--- a/api/src/main/java/io/grpc/TimeUtils.java
+++ b/api/src/main/java/io/grpc/TimeUtils.java
@@ -21,6 +21,7 @@
final class TimeUtils {
private TimeUtils() {}
+ @IgnoreJRERequirement
static long convertToNanos(Duration duration) {
try {
return duration.toNanos();
diff --git a/api/src/test/java/io/grpc/CallOptionsTest.java b/api/src/test/java/io/grpc/CallOptionsTest.java
index d74c74ccd66..65fb7ff3bf2 100644
--- a/api/src/test/java/io/grpc/CallOptionsTest.java
+++ b/api/src/test/java/io/grpc/CallOptionsTest.java
@@ -152,6 +152,7 @@ public void withDeadlineAfter() {
}
@Test
+ @IgnoreJRERequirement
public void withDeadlineAfterDuration() {
Deadline actual = CallOptions.DEFAULT.withDeadlineAfter(Duration.ofMinutes(1L)).getDeadline();
Deadline expected = Deadline.after(1, MINUTES);
diff --git a/api/src/test/java/io/grpc/NameResolverTest.java b/api/src/test/java/io/grpc/NameResolverTest.java
index 1a7c59f8df5..ae8c080bd5c 100644
--- a/api/src/test/java/io/grpc/NameResolverTest.java
+++ b/api/src/test/java/io/grpc/NameResolverTest.java
@@ -47,9 +47,13 @@ public class NameResolverTest {
private static final List ADDRESSES =
Collections.singletonList(
new EquivalentAddressGroup(new FakeSocketAddress("fake-address-1"), Attributes.EMPTY));
- private static final Attributes.Key YOLO_KEY = Attributes.Key.create("yolo");
- private static Attributes ATTRIBUTES = Attributes.newBuilder()
- .set(YOLO_KEY, "To be, or not to be?").build();
+ private static final Attributes.Key YOLO_ATTR_KEY = Attributes.Key.create("yolo");
+ private static Attributes ATTRIBUTES =
+ Attributes.newBuilder().set(YOLO_ATTR_KEY, "To be, or not to be?").build();
+ private static final NameResolver.Args.Key FOO_ARG_KEY =
+ NameResolver.Args.Key.create("foo");
+ private static final NameResolver.Args.Key BAR_ARG_KEY =
+ NameResolver.Args.Key.create("bar");
private static ConfigOrError CONFIG = ConfigOrError.fromConfig("foo");
@Rule
@@ -65,6 +69,7 @@ public class NameResolverTest {
private final Executor executor = Executors.newSingleThreadExecutor();
private final String overrideAuthority = "grpc.io";
private final MetricRecorder metricRecorder = new MetricRecorder() {};
+ private final int customArgValue = 42;
@Mock NameResolver.Listener mockListener;
@Test
@@ -79,6 +84,8 @@ public void args() {
assertThat(args.getOffloadExecutor()).isSameInstanceAs(executor);
assertThat(args.getOverrideAuthority()).isSameInstanceAs(overrideAuthority);
assertThat(args.getMetricRecorder()).isSameInstanceAs(metricRecorder);
+ assertThat(args.getArg(FOO_ARG_KEY)).isEqualTo(customArgValue);
+ assertThat(args.getArg(BAR_ARG_KEY)).isNull();
NameResolver.Args args2 = args.toBuilder().build();
assertThat(args2.getDefaultPort()).isEqualTo(defaultPort);
@@ -90,6 +97,8 @@ public void args() {
assertThat(args2.getOffloadExecutor()).isSameInstanceAs(executor);
assertThat(args2.getOverrideAuthority()).isSameInstanceAs(overrideAuthority);
assertThat(args.getMetricRecorder()).isSameInstanceAs(metricRecorder);
+ assertThat(args.getArg(FOO_ARG_KEY)).isEqualTo(customArgValue);
+ assertThat(args.getArg(BAR_ARG_KEY)).isNull();
assertThat(args2).isNotSameInstanceAs(args);
assertThat(args2).isNotEqualTo(args);
@@ -106,6 +115,7 @@ private NameResolver.Args createArgs() {
.setOffloadExecutor(executor)
.setOverrideAuthority(overrideAuthority)
.setMetricRecorder(metricRecorder)
+ .setArg(FOO_ARG_KEY, customArgValue)
.build();
}
diff --git a/api/src/test/java/io/grpc/StatusExceptionTest.java b/api/src/test/java/io/grpc/StatusExceptionTest.java
index dd0d12dccda..410cfb2289a 100644
--- a/api/src/test/java/io/grpc/StatusExceptionTest.java
+++ b/api/src/test/java/io/grpc/StatusExceptionTest.java
@@ -28,14 +28,6 @@
@RunWith(JUnit4.class)
public class StatusExceptionTest {
- @Test
- public void internalCtorRemovesStack() {
- StackTraceElement[] trace =
- new StatusException(Status.CANCELLED, null, false) {}.getStackTrace();
-
- assertThat(trace).isEmpty();
- }
-
@Test
public void normalCtorKeepsStack() {
StackTraceElement[] trace =
diff --git a/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java b/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java
index ab20c111254..d965ed86253 100644
--- a/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java
+++ b/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java
@@ -31,7 +31,7 @@ public class StatusRuntimeExceptionTest {
@Test
public void internalCtorRemovesStack() {
StackTraceElement[] trace =
- new StatusRuntimeException(Status.CANCELLED, null, false) {}.getStackTrace();
+ new InternalStatusRuntimeException(Status.CANCELLED, null) {}.getStackTrace();
assertThat(trace).isEmpty();
}
diff --git a/api/src/test/java/io/grpc/SynchronizationContextTest.java b/api/src/test/java/io/grpc/SynchronizationContextTest.java
index f0797df227e..668f5ae4d6d 100644
--- a/api/src/test/java/io/grpc/SynchronizationContextTest.java
+++ b/api/src/test/java/io/grpc/SynchronizationContextTest.java
@@ -248,6 +248,7 @@ public void schedule() {
}
@Test
+ @IgnoreJRERequirement
public void scheduleDuration() {
MockScheduledExecutorService executorService = new MockScheduledExecutorService();
ScheduledHandle handle =
@@ -265,6 +266,7 @@ public void scheduleDuration() {
}
@Test
+ @IgnoreJRERequirement
public void scheduleWithFixedDelayDuration() {
MockScheduledExecutorService executorService = new MockScheduledExecutorService();
ScheduledHandle handle =
@@ -402,4 +404,4 @@ static class MockScheduledExecutorService extends ForwardingScheduledExecutorSer
return future = super.scheduleWithFixedDelay(command, intialDelay, delay, unit);
}
}
-}
\ No newline at end of file
+}
diff --git a/api/src/test/java/io/grpc/TimeUtilsTest.java b/api/src/test/java/io/grpc/TimeUtilsTest.java
index 4faaa9cbf6d..728b8512cd7 100644
--- a/api/src/test/java/io/grpc/TimeUtilsTest.java
+++ b/api/src/test/java/io/grpc/TimeUtilsTest.java
@@ -25,6 +25,7 @@
/** Unit tests for {@link TimeUtils}. */
@RunWith(JUnit4.class)
+@IgnoreJRERequirement
public class TimeUtilsTest {
@Test
@@ -56,4 +57,4 @@ public void testConvertTooLargeNegativeDuration() {
assertEquals(Long.MIN_VALUE, TimeUtils.convertToNanos(duration));
}
-}
\ No newline at end of file
+}
diff --git a/api/src/testFixtures/java/io/grpc/testing/DeadlineSubject.java b/api/src/testFixtures/java/io/grpc/testing/DeadlineSubject.java
index 94ab8fb9b18..c2b4d8412a7 100644
--- a/api/src/testFixtures/java/io/grpc/testing/DeadlineSubject.java
+++ b/api/src/testFixtures/java/io/grpc/testing/DeadlineSubject.java
@@ -24,9 +24,9 @@
import com.google.common.truth.ComparableSubject;
import com.google.common.truth.FailureMetadata;
import com.google.common.truth.Subject;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.Deadline;
import java.util.concurrent.TimeUnit;
-import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
/** Propositions for {@link Deadline} subjects. */
diff --git a/auth/build.gradle b/auth/build.gradle
index 78bb720601b..d56802c14ca 100644
--- a/auth/build.gradle
+++ b/auth/build.gradle
@@ -22,6 +22,14 @@ dependencies {
project(':grpc-core'),
project(":grpc-context"), // Override google-auth dependency with our newer version
libraries.google.auth.oauth2Http
- signature libraries.signature.java
- signature libraries.signature.android
+ signature (libraries.signature.java) {
+ artifact {
+ extension = "signature"
+ }
+ }
+ signature (libraries.signature.android) {
+ artifact {
+ extension = "signature"
+ }
+ }
}
diff --git a/authz/build.gradle b/authz/build.gradle
index 60c86ca0dba..b72088bfbaa 100644
--- a/authz/build.gradle
+++ b/authz/build.gradle
@@ -26,7 +26,11 @@ dependencies {
shadow configurations.implementation.getDependencies().minus([xdsDependency])
shadow project(path: ':grpc-xds', configuration: 'shadow')
- signature libraries.signature.java
+ signature (libraries.signature.java) {
+ artifact {
+ extension = "signature"
+ }
+ }
}
tasks.named("jar").configure {
diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle
index d00c0d76ebe..bf043106050 100644
--- a/benchmarks/build.gradle
+++ b/benchmarks/build.gradle
@@ -43,7 +43,11 @@ dependencies {
testImplementation libraries.junit,
libraries.mockito.core
- signature libraries.signature.java
+ signature (libraries.signature.java) {
+ artifact {
+ extension = "signature"
+ }
+ }
}
import net.ltgt.gradle.errorprone.CheckSeverity
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 e62c2274ee9..242d4551d6e 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
@@ -184,6 +184,21 @@ public BenchmarkServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions
return BenchmarkServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static BenchmarkServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public BenchmarkServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new BenchmarkServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return BenchmarkServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -367,6 +382,87 @@ public io.grpc.stub.StreamObserver {
+ private BenchmarkServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected BenchmarkServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new BenchmarkServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * One request followed by one response.
+ * The server returns the client payload as-is.
+ *
+ * Repeated sequence of one request followed by one response.
+ * Should be called streaming ping-pong
+ * The server returns the client payload as-is on each response
+ *
+ * Two-sided unbounded streaming between server to client
+ * Both sides send the content of their own choice to the other
+ *
+ */
+ @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
+ public io.grpc.stub.BlockingClientCall
+ streamingBothWays() {
+ return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
+ getChannel(), getStreamingBothWaysMethod(), getCallOptions());
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service BenchmarkService.
+ */
public static final class BenchmarkServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private BenchmarkServiceBlockingStub(
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 b24c3813c19..8f466185ea0 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
@@ -60,6 +60,21 @@ public ReportQpsScenarioServiceStub newStub(io.grpc.Channel channel, io.grpc.Cal
return ReportQpsScenarioServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static ReportQpsScenarioServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public ReportQpsScenarioServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new ReportQpsScenarioServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return ReportQpsScenarioServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -147,6 +162,33 @@ public void reportScenario(io.grpc.benchmarks.proto.Control.ScenarioResult reque
/**
* A stub to allow clients to do synchronous rpc calls to service ReportQpsScenarioService.
*/
+ public static final class ReportQpsScenarioServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private ReportQpsScenarioServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected ReportQpsScenarioServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new ReportQpsScenarioServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * Report results of a QPS test benchmark scenario.
+ *
+ */
+ public io.grpc.benchmarks.proto.Control.Void reportScenario(io.grpc.benchmarks.proto.Control.ScenarioResult request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getReportScenarioMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service ReportQpsScenarioService.
+ */
public static final class ReportQpsScenarioServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private ReportQpsScenarioServiceBlockingStub(
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 0ee6797c8e3..11859482972 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
@@ -153,6 +153,21 @@ public WorkerServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions ca
return WorkerServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static WorkerServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public WorkerServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new WorkerServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return WorkerServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -323,6 +338,77 @@ public void quitWorker(io.grpc.benchmarks.proto.Control.Void request,
/**
* A stub to allow clients to do synchronous rpc calls to service WorkerService.
*/
+ public static final class WorkerServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private WorkerServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected WorkerServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new WorkerServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * Start server with specified workload.
+ * First request sent specifies the ServerConfig followed by ServerStatus
+ * response. After that, a "Mark" can be sent anytime to request the latest
+ * stats. Closing the stream will initiate shutdown of the test server
+ * and once the shutdown has finished, the OK status is sent to terminate
+ * this RPC.
+ *
+ * Start client with specified workload.
+ * First request sent specifies the ClientConfig followed by ClientStatus
+ * response. After that, a "Mark" can be sent anytime to request the latest
+ * stats. Closing the stream will initiate shutdown of the test client
+ * and once the shutdown has finished, the OK status is sent to terminate
+ * this RPC.
+ *
+ */
+ public io.grpc.benchmarks.proto.Control.Void quitWorker(io.grpc.benchmarks.proto.Control.Void request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getQuitWorkerMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service WorkerService.
+ */
public static final class WorkerServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private WorkerServiceBlockingStub(
diff --git a/binder/build.gradle b/binder/build.gradle
index e18361e08b3..3390e02fce7 100644
--- a/binder/build.gradle
+++ b/binder/build.gradle
@@ -32,7 +32,6 @@ android {
repositories {
google()
- mavenCentral()
}
dependencies {
diff --git a/binder/src/androidTest/java/io/grpc/binder/HostServices.java b/binder/src/androidTest/java/io/grpc/binder/HostServices.java
index 4aa46e8254a..5d4a06a27fe 100644
--- a/binder/src/androidTest/java/io/grpc/binder/HostServices.java
+++ b/binder/src/androidTest/java/io/grpc/binder/HostServices.java
@@ -29,6 +29,7 @@
import androidx.lifecycle.LifecycleService;
import com.google.auto.value.AutoValue;
import com.google.common.base.Supplier;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Server;
import java.io.IOException;
import java.util.HashMap;
@@ -38,7 +39,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
/**
* A test helper class for creating android services to host gRPC servers.
diff --git a/binder/src/androidTest/java/io/grpc/binder/internal/BinderClientTransportTest.java b/binder/src/androidTest/java/io/grpc/binder/internal/BinderClientTransportTest.java
index c84a1fc296f..33c127f97a7 100644
--- a/binder/src/androidTest/java/io/grpc/binder/internal/BinderClientTransportTest.java
+++ b/binder/src/androidTest/java/io/grpc/binder/internal/BinderClientTransportTest.java
@@ -27,6 +27,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import com.google.protobuf.Empty;
import io.grpc.CallOptions;
import io.grpc.ClientStreamTracer;
@@ -64,7 +65,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/binder/src/main/java/io/grpc/binder/ApiConstants.java b/binder/src/main/java/io/grpc/binder/ApiConstants.java
index 43e94338fdc..292c580c2b8 100644
--- a/binder/src/main/java/io/grpc/binder/ApiConstants.java
+++ b/binder/src/main/java/io/grpc/binder/ApiConstants.java
@@ -17,7 +17,9 @@
package io.grpc.binder;
import android.content.Intent;
+import android.os.UserHandle;
import io.grpc.ExperimentalApi;
+import io.grpc.NameResolver;
/** Constant parts of the gRPC binder transport public API. */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8022")
@@ -29,4 +31,16 @@ private ApiConstants() {}
* themselves in a {@link android.app.Service#onBind(Intent)} call.
*/
public static final String ACTION_BIND = "grpc.io.action.BIND";
+
+ /**
+ * Specifies the Android user in which target URIs should be resolved.
+ *
+ *
{@link UserHandle} can't reasonably be encoded in a target URI string. Instead, all
+ * {@link io.grpc.NameResolverProvider}s producing {@link AndroidComponentAddress}es should let
+ * clients address servers in another Android user using this argument.
+ *
+ *
See also {@link AndroidComponentAddress#getTargetUser()}.
+ */
+ public static final NameResolver.Args.Key TARGET_ANDROID_USER =
+ NameResolver.Args.Key.create("target-android-user");
}
diff --git a/binder/src/main/java/io/grpc/binder/AsyncSecurityPolicy.java b/binder/src/main/java/io/grpc/binder/AsyncSecurityPolicy.java
index 2a37e6fd517..5b17ad35977 100644
--- a/binder/src/main/java/io/grpc/binder/AsyncSecurityPolicy.java
+++ b/binder/src/main/java/io/grpc/binder/AsyncSecurityPolicy.java
@@ -17,11 +17,11 @@
package io.grpc.binder;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.ExperimentalApi;
import io.grpc.Status;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
-import javax.annotation.CheckReturnValue;
/**
* Decides whether a given Android UID is authorized to access some resource.
diff --git a/binder/src/main/java/io/grpc/binder/SecurityPolicy.java b/binder/src/main/java/io/grpc/binder/SecurityPolicy.java
index e539f17e394..261e5223a0f 100644
--- a/binder/src/main/java/io/grpc/binder/SecurityPolicy.java
+++ b/binder/src/main/java/io/grpc/binder/SecurityPolicy.java
@@ -16,8 +16,8 @@
package io.grpc.binder;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.Status;
-import javax.annotation.CheckReturnValue;
/**
* Decides whether a given Android UID is authorized to access some resource.
diff --git a/binder/src/main/java/io/grpc/binder/ServerSecurityPolicy.java b/binder/src/main/java/io/grpc/binder/ServerSecurityPolicy.java
index 6a9361c0eaf..4786a5e6cc4 100644
--- a/binder/src/main/java/io/grpc/binder/ServerSecurityPolicy.java
+++ b/binder/src/main/java/io/grpc/binder/ServerSecurityPolicy.java
@@ -19,10 +19,10 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.Status;
import java.util.HashMap;
import java.util.Map;
-import javax.annotation.CheckReturnValue;
/**
* A security policy for a gRPC server.
diff --git a/binder/src/main/java/io/grpc/binder/UntrustedSecurityPolicies.java b/binder/src/main/java/io/grpc/binder/UntrustedSecurityPolicies.java
index 64d8ac1426a..44612a82109 100644
--- a/binder/src/main/java/io/grpc/binder/UntrustedSecurityPolicies.java
+++ b/binder/src/main/java/io/grpc/binder/UntrustedSecurityPolicies.java
@@ -16,9 +16,9 @@
package io.grpc.binder;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.ExperimentalApi;
import io.grpc.Status;
-import javax.annotation.CheckReturnValue;
/** Static factory methods for creating untrusted security policies. */
@CheckReturnValue
diff --git a/binder/src/main/java/io/grpc/binder/internal/ActiveTransportTracker.java b/binder/src/main/java/io/grpc/binder/internal/ActiveTransportTracker.java
index ad410186486..2bfa9fea4cb 100644
--- a/binder/src/main/java/io/grpc/binder/internal/ActiveTransportTracker.java
+++ b/binder/src/main/java/io/grpc/binder/internal/ActiveTransportTracker.java
@@ -2,13 +2,13 @@
import static com.google.common.base.Preconditions.checkState;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Attributes;
import io.grpc.Metadata;
import io.grpc.internal.ServerListener;
import io.grpc.internal.ServerStream;
import io.grpc.internal.ServerTransport;
import io.grpc.internal.ServerTransportListener;
-import javax.annotation.concurrent.GuardedBy;
/**
* Tracks which {@link BinderTransport.BinderServerTransport} are currently active and allows
diff --git a/binder/src/main/java/io/grpc/binder/internal/BinderServer.java b/binder/src/main/java/io/grpc/binder/internal/BinderServer.java
index 0ad54fb74d1..6b8347390b9 100644
--- a/binder/src/main/java/io/grpc/binder/internal/BinderServer.java
+++ b/binder/src/main/java/io/grpc/binder/internal/BinderServer.java
@@ -25,6 +25,7 @@
import android.os.Parcel;
import android.os.RemoteException;
import com.google.common.collect.ImmutableList;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Attributes;
import io.grpc.Grpc;
import io.grpc.InternalChannelz.SocketStats;
@@ -48,7 +49,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
diff --git a/binder/src/main/java/io/grpc/binder/internal/BinderTransport.java b/binder/src/main/java/io/grpc/binder/internal/BinderTransport.java
index 254ad5bb407..f61c455edd5 100644
--- a/binder/src/main/java/io/grpc/binder/internal/BinderTransport.java
+++ b/binder/src/main/java/io/grpc/binder/internal/BinderTransport.java
@@ -35,6 +35,8 @@
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.errorprone.annotations.CheckReturnValue;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Attributes;
import io.grpc.CallOptions;
import io.grpc.ClientStreamTracer;
@@ -78,9 +80,7 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
diff --git a/binder/src/main/java/io/grpc/binder/internal/BinderTransportSecurity.java b/binder/src/main/java/io/grpc/binder/internal/BinderTransportSecurity.java
index 430eee3e041..6f95ef8a83c 100644
--- a/binder/src/main/java/io/grpc/binder/internal/BinderTransportSecurity.java
+++ b/binder/src/main/java/io/grpc/binder/internal/BinderTransportSecurity.java
@@ -20,6 +20,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
+import com.google.errorprone.annotations.CheckReturnValue;
import io.grpc.Attributes;
import io.grpc.Internal;
import io.grpc.Metadata;
@@ -35,7 +36,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
-import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
/**
diff --git a/binder/src/main/java/io/grpc/binder/internal/FlowController.java b/binder/src/main/java/io/grpc/binder/internal/FlowController.java
index 1972ea00e6c..135f363a01e 100644
--- a/binder/src/main/java/io/grpc/binder/internal/FlowController.java
+++ b/binder/src/main/java/io/grpc/binder/internal/FlowController.java
@@ -15,7 +15,7 @@
*/
package io.grpc.binder.internal;
-import javax.annotation.concurrent.GuardedBy;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
/** Keeps track of the number of bytes on the wire in a single direction. */
final class FlowController {
diff --git a/binder/src/main/java/io/grpc/binder/internal/Inbound.java b/binder/src/main/java/io/grpc/binder/internal/Inbound.java
index 19c0e4a0f08..50654297c74 100644
--- a/binder/src/main/java/io/grpc/binder/internal/Inbound.java
+++ b/binder/src/main/java/io/grpc/binder/internal/Inbound.java
@@ -20,6 +20,7 @@
import static com.google.common.base.Preconditions.checkState;
import android.os.Parcel;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Attributes;
import io.grpc.Metadata;
import io.grpc.Status;
@@ -34,7 +35,6 @@
import java.io.InputStream;
import java.util.ArrayList;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
/**
* Handles incoming binder transactions for a single stream, turning those transactions into calls
diff --git a/binder/src/main/java/io/grpc/binder/internal/Outbound.java b/binder/src/main/java/io/grpc/binder/internal/Outbound.java
index e2896be02a1..f395fe1701f 100644
--- a/binder/src/main/java/io/grpc/binder/internal/Outbound.java
+++ b/binder/src/main/java/io/grpc/binder/internal/Outbound.java
@@ -22,6 +22,7 @@
import static java.lang.Math.max;
import android.os.Parcel;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Deadline;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
@@ -34,7 +35,6 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
/**
* Sends the set of outbound transactions for a single BinderStream (rpc).
diff --git a/binder/src/main/java/io/grpc/binder/internal/PingTracker.java b/binder/src/main/java/io/grpc/binder/internal/PingTracker.java
index 33fcb43918f..ab20af4d6ef 100644
--- a/binder/src/main/java/io/grpc/binder/internal/PingTracker.java
+++ b/binder/src/main/java/io/grpc/binder/internal/PingTracker.java
@@ -17,12 +17,12 @@
package io.grpc.binder.internal;
import com.google.common.base.Ticker;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Status;
import io.grpc.StatusException;
import io.grpc.internal.ClientTransport.PingCallback;
import java.util.concurrent.Executor;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
/**
* Tracks an ongoing ping request for a client-side binder transport. We only handle a single active
diff --git a/binder/src/main/java/io/grpc/binder/internal/ServiceBinding.java b/binder/src/main/java/io/grpc/binder/internal/ServiceBinding.java
index 76f1d7aa9f7..ee171140045 100644
--- a/binder/src/main/java/io/grpc/binder/internal/ServiceBinding.java
+++ b/binder/src/main/java/io/grpc/binder/internal/ServiceBinding.java
@@ -28,13 +28,13 @@
import androidx.annotation.AnyThread;
import androidx.annotation.MainThread;
import com.google.common.annotations.VisibleForTesting;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Status;
import io.grpc.binder.BinderChannelCredentials;
import java.util.concurrent.Executor;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
diff --git a/build.gradle b/build.gradle
index 52ca19ab4ba..09c78735776 100644
--- a/build.gradle
+++ b/build.gradle
@@ -21,13 +21,28 @@ subprojects {
apply plugin: "net.ltgt.errorprone"
group = "io.grpc"
- version = "1.70.0-SNAPSHOT" // CURRENT_GRPC_VERSION
+ version = "1.71.0-SNAPSHOT" // CURRENT_GRPC_VERSION
repositories {
maven { // The google mirror is less flaky than mavenCentral()
- url "https://maven-central.storage-download.googleapis.com/maven2/" }
- mavenCentral()
- mavenLocal()
+ url "https://maven-central.storage-download.googleapis.com/maven2/"
+ metadataSources {
+ mavenPom()
+ ignoreGradleMetadataRedirection()
+ }
+ }
+ mavenCentral() {
+ metadataSources {
+ mavenPom()
+ ignoreGradleMetadataRedirection()
+ }
+ }
+ mavenLocal() {
+ metadataSources {
+ mavenPom()
+ ignoreGradleMetadataRedirection()
+ }
+ }
}
tasks.withType(JavaCompile).configureEach {
diff --git a/buildscripts/checkstyle.xml b/buildscripts/checkstyle.xml
index 035b1dfc900..0ec8ecc79ce 100644
--- a/buildscripts/checkstyle.xml
+++ b/buildscripts/checkstyle.xml
@@ -38,6 +38,12 @@
+
+
+
+
+
+
diff --git a/census/BUILD.bazel b/census/BUILD.bazel
index aec16c46af0..36be88fc3d8 100644
--- a/census/BUILD.bazel
+++ b/census/BUILD.bazel
@@ -10,6 +10,7 @@ java_library(
"//api",
"//context",
artifact("com.google.code.findbugs:jsr305"),
+ artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("io.opencensus:opencensus-api"),
artifact("io.opencensus:opencensus-contrib-grpc-metrics"),
diff --git a/census/build.gradle b/census/build.gradle
index c1dc53e4c05..0993488ff83 100644
--- a/census/build.gradle
+++ b/census/build.gradle
@@ -27,8 +27,16 @@ dependencies {
project(':grpc-testing'),
libraries.opencensus.impl
- signature libraries.signature.java
- signature libraries.signature.android
+ signature (libraries.signature.java) {
+ artifact {
+ extension = "signature"
+ }
+ }
+ signature (libraries.signature.android) {
+ artifact {
+ extension = "signature"
+ }
+ }
}
tasks.named("javadoc").configure {
diff --git a/census/src/main/java/io/grpc/census/CensusStatsModule.java b/census/src/main/java/io/grpc/census/CensusStatsModule.java
index ad16bef9604..8f571ceb627 100644
--- a/census/src/main/java/io/grpc/census/CensusStatsModule.java
+++ b/census/src/main/java/io/grpc/census/CensusStatsModule.java
@@ -22,6 +22,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import io.grpc.Attributes;
import io.grpc.CallOptions;
import io.grpc.Channel;
@@ -62,7 +63,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
/**
* Provides factories for {@link StreamTracer} that records stats to Census.
diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp
index 8693fad1b66..df96bb1c1b2 100644
--- a/compiler/src/java_plugin/cpp/java_generator.cpp
+++ b/compiler/src/java_plugin/cpp/java_generator.cpp
@@ -355,13 +355,15 @@ enum StubType {
BLOCKING_CLIENT_IMPL = 5,
FUTURE_CLIENT_IMPL = 6,
ABSTRACT_CLASS = 7,
- NONE = 8,
+ BLOCKING_V2_CLIENT_IMPL = 8,
+ NONE = 999,
};
enum CallType {
ASYNC_CALL = 0,
BLOCKING_CALL = 1,
- FUTURE_CALL = 2
+ FUTURE_CALL = 2,
+ BLOCKING_V2_CALL = 3,
};
// TODO(nmittler): Remove once protobuf includes javadoc methods in distribution.
@@ -410,6 +412,9 @@ static void GrpcWriteServiceDocComment(Printer* printer,
printer->Print(vars, " * A stub to allow clients to do asynchronous rpc calls to service $service$.\n");
break;
case BLOCKING_CLIENT_IMPL:
+ printer->Print(vars, " * A stub to allow clients to do limited synchronous rpc calls to service $service$.\n");
+ break;
+ case BLOCKING_V2_CLIENT_IMPL:
printer->Print(vars, " * A stub to allow clients to do synchronous rpc calls to service $service$.\n");
break;
case FUTURE_CLIENT_IMPL:
@@ -555,6 +560,9 @@ static void PrintStubFactory(
case BLOCKING_CLIENT_IMPL:
stub_type_name = "Blocking";
break;
+ case BLOCKING_V2_CLIENT_IMPL:
+ stub_type_name = "BlockingV2";
+ break;
default:
GRPC_CODEGEN_FAIL << "Cannot generate StubFactory for StubType: " << type;
}
@@ -597,6 +605,11 @@ static void PrintStub(
stub_name += "BlockingStub";
stub_base_class_name = "AbstractBlockingStub";
break;
+ case BLOCKING_V2_CLIENT_IMPL:
+ call_type = BLOCKING_V2_CALL;
+ stub_name += "BlockingV2Stub";
+ stub_base_class_name = "AbstractBlockingStub";
+ break;
case FUTURE_CLIENT_IMPL:
call_type = FUTURE_CALL;
stub_name += "FutureStub";
@@ -679,13 +692,17 @@ static void PrintStub(
// Method signature
p->Print("\n");
- // TODO(nmittler): Replace with WriteMethodDocComment once included by the protobuf distro.
GrpcWriteMethodDocComment(p, method);
if (method->options().deprecated()) {
p->Print(*vars, "@$Deprecated$\n");
}
+ if ((call_type == BLOCKING_CALL && client_streaming && server_streaming)
+ || (call_type == BLOCKING_V2_CALL && (client_streaming || server_streaming))) {
+ p->Print(*vars, "@io.grpc.ExperimentalApi(\"https://github.com/grpc/grpc-java/issues/10918\")\n");
+ }
+
if (!interface) {
p->Print("public ");
} else {
@@ -695,7 +712,12 @@ static void PrintStub(
case BLOCKING_CALL:
GRPC_CODEGEN_CHECK(!client_streaming)
<< "Blocking client interface with client streaming is unavailable";
- if (server_streaming) {
+ if (client_streaming && server_streaming) {
+ p->Print(
+ *vars,
+ "$BlockingClientCall$<$input_type$, $output_type$>\n"
+ " $lower_method_name$()");
+ } else if (server_streaming) {
// Server streaming
p->Print(
*vars,
@@ -708,6 +730,25 @@ static void PrintStub(
"$output_type$ $lower_method_name$($input_type$ request)");
}
break;
+ case BLOCKING_V2_CALL:
+ if (client_streaming) { // Both Bidi and Client Streaming
+ p->Print(
+ *vars,
+ "$BlockingClientCall$<$input_type$, $output_type$>\n"
+ " $lower_method_name$()");
+ } else if (server_streaming) {
+ // Server streaming
+ p->Print(
+ *vars,
+ "$BlockingClientCall$, $output_type$>\n"
+ " $lower_method_name$($input_type$ request)");
+ } else {
+ // Simple RPC
+ p->Print(
+ *vars,
+ "$output_type$ $lower_method_name$($input_type$ request)");
+ }
+ break;
case ASYNC_CALL:
if (client_streaming) {
// Bidirectional streaming or client streaming
@@ -753,21 +794,46 @@ static void PrintStub(
"$method_method_name$(), responseObserver);\n");
}
} else if (!interface) {
- switch (call_type) {
+ switch (call_type) {
case BLOCKING_CALL:
GRPC_CODEGEN_CHECK(!client_streaming)
- << "Blocking client streaming interface is not available";
- if (server_streaming) {
- (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingServerStreamingCall";
- (*vars)["params"] = "request";
- } else {
- (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingUnaryCall";
- (*vars)["params"] = "request";
+ << "Blocking client and bidi streaming interface are not available";
+ if (server_streaming) {
+ (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingServerStreamingCall";
+ (*vars)["params"] = "request";
+ } else {
+ (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingUnaryCall";
+ (*vars)["params"] = "request";
+ }
+ p->Print(
+ *vars,
+ "return $calls_method$(\n"
+ " getChannel(), $method_method_name$(), getCallOptions(), $params$);\n");
+ break;
+ case BLOCKING_V2_CALL:
+ if (client_streaming) { // client and bidi streaming
+ if (server_streaming) {
+ (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingBidiStreamingCall";
+ } else {
+ (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingClientStreamingCall";
+ }
+ p->Print(
+ *vars,
+ "return $calls_method$(\n"
+ " getChannel(), $method_method_name$(), getCallOptions());\n");
+ } else { // server streaming and unary
+ (*vars)["params"] = "request";
+ if (server_streaming) {
+ (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall";
+ } else {
+ (*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingUnaryCall";
+ }
+
+ p->Print(
+ *vars,
+ "return $calls_method$(\n"
+ " getChannel(), $method_method_name$(), getCallOptions(), $params$);\n");
}
- p->Print(
- *vars,
- "return $calls_method$(\n"
- " getChannel(), $method_method_name$(), getCallOptions(), $params$);\n");
break;
case ASYNC_CALL:
if (server_streaming) {
@@ -804,7 +870,7 @@ static void PrintStub(
"return $calls_method$(\n"
" getChannel().newCall($method_method_name$(), getCallOptions()), request);\n");
break;
- }
+ }
} else {
GRPC_CODEGEN_FAIL << "Do not create Stub interfaces";
}
@@ -1173,6 +1239,21 @@ static void PrintService(const ServiceDescriptor* service,
p->Outdent();
p->Print("}\n\n");
+ // TODO(nmittler): Replace with WriteDocComment once included by protobuf distro.
+ GrpcWriteDocComment(p, " Creates a new blocking-style stub that supports all types of calls "
+ "on the service");
+ p->Print(
+ *vars,
+ "public static $service_name$BlockingV2Stub newBlockingV2Stub(\n"
+ " $Channel$ channel) {\n");
+ p->Indent();
+ PrintStubFactory(service, vars, p, BLOCKING_V2_CLIENT_IMPL);
+ p->Print(
+ *vars,
+ "return $service_name$BlockingV2Stub.newStub(factory, channel);\n");
+ p->Outdent();
+ p->Print("}\n\n");
+
// TODO(nmittler): Replace with WriteDocComment once included by protobuf distro.
GrpcWriteDocComment(p, " Creates a new blocking-style stub that supports unary and streaming "
"output calls on the service");
@@ -1206,6 +1287,7 @@ static void PrintService(const ServiceDescriptor* service,
PrintStub(service, vars, p, ASYNC_INTERFACE);
PrintAbstractClassStub(service, vars, p);
PrintStub(service, vars, p, ASYNC_CLIENT_IMPL);
+ PrintStub(service, vars, p, BLOCKING_V2_CLIENT_IMPL);
PrintStub(service, vars, p, BLOCKING_CLIENT_IMPL);
PrintStub(service, vars, p, FUTURE_CLIENT_IMPL);
@@ -1257,6 +1339,7 @@ void GenerateService(const ServiceDescriptor* service,
vars["RpcMethod"] = "io.grpc.stub.annotations.RpcMethod";
vars["MethodDescriptor"] = "io.grpc.MethodDescriptor";
vars["StreamObserver"] = "io.grpc.stub.StreamObserver";
+ vars["BlockingClientCall"] = "io.grpc.stub.BlockingClientCall";
vars["Iterator"] = "java.util.Iterator";
vars["GrpcGenerated"] = "io.grpc.stub.annotations.GrpcGenerated";
vars["ListenableFuture"] =
diff --git a/compiler/src/test/golden/TestDeprecatedService.java.txt b/compiler/src/test/golden/TestDeprecatedService.java.txt
index 36ff11a160a..e696def7b99 100644
--- a/compiler/src/test/golden/TestDeprecatedService.java.txt
+++ b/compiler/src/test/golden/TestDeprecatedService.java.txt
@@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
*
*/
@javax.annotation.Generated(
- value = "by gRPC proto compiler (version 1.70.0-SNAPSHOT)",
+ value = "by gRPC proto compiler (version 1.71.0-SNAPSHOT)",
comments = "Source: grpc/testing/compiler/test.proto")
@io.grpc.stub.annotations.GrpcGenerated
@java.lang.Deprecated
@@ -64,6 +64,21 @@ public final class TestDeprecatedServiceGrpc {
return TestDeprecatedServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static TestDeprecatedServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public TestDeprecatedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new TestDeprecatedServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return TestDeprecatedServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -169,6 +184,38 @@ public final class TestDeprecatedServiceGrpc {
*
*/
@java.lang.Deprecated
+ public static final class TestDeprecatedServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private TestDeprecatedServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected TestDeprecatedServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new TestDeprecatedServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * An RPC method that has been deprecated and should generate with Java's @Deprecated annotation
+ *
+ */
+ @java.lang.Deprecated
+ public io.grpc.testing.compiler.Test.SimpleResponse deprecatedMethod(io.grpc.testing.compiler.Test.SimpleRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getDeprecatedMethodMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ * A stub to allow clients to do limited synchronous rpc calls to service TestDeprecatedService.
+ *
+ * Test service that has been deprecated and should generate with Java's @Deprecated annotation
+ *
+ */
+ @java.lang.Deprecated
public static final class TestDeprecatedServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private TestDeprecatedServiceBlockingStub(
diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt
index 69a1b0947b5..c052093cbbc 100644
--- a/compiler/src/test/golden/TestService.java.txt
+++ b/compiler/src/test/golden/TestService.java.txt
@@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
*
*/
@javax.annotation.Generated(
- value = "by gRPC proto compiler (version 1.70.0-SNAPSHOT)",
+ value = "by gRPC proto compiler (version 1.71.0-SNAPSHOT)",
comments = "Source: grpc/testing/compiler/test.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class TestServiceGrpc {
@@ -282,6 +282,21 @@ public final class TestServiceGrpc {
return TestServiceStub.newStub(factory, channel);
}
+ /**
+ * Creates a new blocking-style stub that supports all types of calls on the service
+ */
+ public static TestServiceBlockingV2Stub newBlockingV2Stub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public TestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new TestServiceBlockingV2Stub(channel, callOptions);
+ }
+ };
+ return TestServiceBlockingV2Stub.newStub(factory, channel);
+ }
+
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
@@ -546,6 +561,125 @@ public final class TestServiceGrpc {
* Test service that supports all call types.
*
*/
+ public static final class TestServiceBlockingV2Stub
+ extends io.grpc.stub.AbstractBlockingStub {
+ private TestServiceBlockingV2Stub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected TestServiceBlockingV2Stub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new TestServiceBlockingV2Stub(channel, callOptions);
+ }
+
+ /**
+ *
+ * One request followed by one response.
+ * The server returns the client payload as-is.
+ *
+ * A sequence of requests with each request served by the server immediately.
+ * As one request could lead to multiple responses, this interface
+ * demonstrates the idea of full bidirectionality.
+ *
+ * A sequence of requests followed by a sequence of responses.
+ * The server buffers all the client requests and then serves them in order. A
+ * stream of responses are returned to the client when the server starts with
+ * first request.
+ *
+ * A sequence of requests with each request served by the server immediately.
+ * As one request could lead to multiple responses, this interface
+ * demonstrates the idea of full bidirectionality.
+ *
+ * A sequence of requests followed by a sequence of responses.
+ * The server buffers all the client requests and then serves them in order. A
+ * stream of responses are returned to the client when the server starts with
+ * first request.
+ *