mirror of https://github.com/grpc/grpc-java.git
Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
|
fa5cfcd63c | |
|
3782ba89a0 | |
|
1dac376256 | |
|
e225c23552 | |
|
197a15c9c9 | |
|
2636d5dda0 | |
|
468b29cb35 | |
|
16f93c8127 | |
|
2b533529df | |
|
135f433bcd | |
|
2d0c158987 |
|
@ -2,7 +2,7 @@ module(
|
|||
name = "grpc-java",
|
||||
compatibility_level = 0,
|
||||
repo_name = "io_grpc_grpc_java",
|
||||
version = "1.68.0-SNAPSHOT", # CURRENT_GRPC_VERSION
|
||||
version = "1.68.2", # CURRENT_GRPC_VERSION
|
||||
)
|
||||
|
||||
# GRPC_DEPS_START
|
||||
|
|
36
README.md
36
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.67.1/examples) and the
|
||||
[Android example](https://github.com/grpc/grpc-java/tree/v1.67.1/examples/android)
|
||||
The [examples](https://github.com/grpc/grpc-java/tree/v1.68.2/examples) and the
|
||||
[Android example](https://github.com/grpc/grpc-java/tree/v1.68.2/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`:
|
|||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-netty-shaded</artifactId>
|
||||
<version>1.67.1</version>
|
||||
<version>1.68.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-protobuf</artifactId>
|
||||
<version>1.67.1</version>
|
||||
<version>1.68.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-stub</artifactId>
|
||||
<version>1.67.1</version>
|
||||
<version>1.68.2</version>
|
||||
</dependency>
|
||||
<dependency> <!-- necessary for Java 9+ -->
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
|
@ -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.67.1'
|
||||
implementation 'io.grpc:grpc-protobuf:1.67.1'
|
||||
implementation 'io.grpc:grpc-stub:1.67.1'
|
||||
runtimeOnly 'io.grpc:grpc-netty-shaded:1.68.2'
|
||||
implementation 'io.grpc:grpc-protobuf:1.68.2'
|
||||
implementation 'io.grpc:grpc-stub:1.68.2'
|
||||
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.67.1'
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.67.1'
|
||||
implementation 'io.grpc:grpc-stub:1.67.1'
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.2'
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.2'
|
||||
implementation 'io.grpc:grpc-stub:1.68.2'
|
||||
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.67.1
|
||||
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.68.2
|
||||
|
||||
Development snapshots are available in [Sonatypes's snapshot
|
||||
repository](https://oss.sonatype.org/content/repositories/snapshots/).
|
||||
|
@ -129,9 +129,9 @@ For protobuf-based codegen integrated with the Maven build system, you can use
|
|||
<artifactId>protobuf-maven-plugin</artifactId>
|
||||
<version>0.6.1</version>
|
||||
<configuration>
|
||||
<protocArtifact>com.google.protobuf:protoc:3.25.3:exe:${os.detected.classifier}</protocArtifact>
|
||||
<protocArtifact>com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}</protocArtifact>
|
||||
<pluginId>grpc-java</pluginId>
|
||||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.67.1:exe:${os.detected.classifier}</pluginArtifact>
|
||||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.68.2:exe:${os.detected.classifier}</pluginArtifact>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -157,11 +157,11 @@ plugins {
|
|||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:3.25.3"
|
||||
artifact = "com.google.protobuf:protoc:3.25.5"
|
||||
}
|
||||
plugins {
|
||||
grpc {
|
||||
artifact = 'io.grpc:protoc-gen-grpc-java:1.67.1'
|
||||
artifact = 'io.grpc:protoc-gen-grpc-java:1.68.2'
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
|
@ -190,11 +190,11 @@ plugins {
|
|||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:3.25.3"
|
||||
artifact = "com.google.protobuf:protoc:3.25.5"
|
||||
}
|
||||
plugins {
|
||||
grpc {
|
||||
artifact = 'io.grpc:protoc-gen-grpc-java:1.67.1'
|
||||
artifact = 'io.grpc:protoc-gen-grpc-java:1.68.2'
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
|
|
|
@ -219,13 +219,15 @@ public abstract class NameResolver {
|
|||
@Override
|
||||
@Deprecated
|
||||
@InlineMe(
|
||||
replacement = "this.onResult2(ResolutionResult.newBuilder().setAddressesOrError("
|
||||
replacement = "this.onResult(ResolutionResult.newBuilder().setAddressesOrError("
|
||||
+ "StatusOr.fromValue(servers)).setAttributes(attributes).build())",
|
||||
imports = {"io.grpc.NameResolver.ResolutionResult", "io.grpc.StatusOr"})
|
||||
public final void onAddresses(
|
||||
List<EquivalentAddressGroup> servers, @ResolutionResultAttr Attributes attributes) {
|
||||
// TODO(jihuncho) need to promote Listener2 if we want to use ConfigOrError
|
||||
onResult2(
|
||||
// Calling onResult and not onResult2 because onResult2 can only be called from a
|
||||
// synchronization context.
|
||||
onResult(
|
||||
ResolutionResult.newBuilder().setAddressesOrError(
|
||||
StatusOr.fromValue(servers)).setAttributes(attributes).build());
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ subprojects {
|
|||
apply plugin: "net.ltgt.errorprone"
|
||||
|
||||
group = "io.grpc"
|
||||
version = "1.68.0-SNAPSHOT" // CURRENT_GRPC_VERSION
|
||||
version = "1.68.2" // CURRENT_GRPC_VERSION
|
||||
|
||||
repositories {
|
||||
maven { // The google mirror is less flaky than mavenCentral()
|
||||
|
|
|
@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
|
|||
* </pre>
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler (version 1.68.0-SNAPSHOT)",
|
||||
value = "by gRPC proto compiler (version 1.68.2)",
|
||||
comments = "Source: grpc/testing/compiler/test.proto")
|
||||
@io.grpc.stub.annotations.GrpcGenerated
|
||||
@java.lang.Deprecated
|
||||
|
|
|
@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
|
|||
* </pre>
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler (version 1.68.0-SNAPSHOT)",
|
||||
value = "by gRPC proto compiler (version 1.68.2)",
|
||||
comments = "Source: grpc/testing/compiler/test.proto")
|
||||
@io.grpc.stub.annotations.GrpcGenerated
|
||||
public final class TestServiceGrpc {
|
||||
|
|
|
@ -219,7 +219,7 @@ public final class GrpcUtil {
|
|||
|
||||
public static final Splitter ACCEPT_ENCODING_SPLITTER = Splitter.on(',').trimResults();
|
||||
|
||||
public static final String IMPLEMENTATION_VERSION = "1.68.0-SNAPSHOT"; // CURRENT_GRPC_VERSION
|
||||
public static final String IMPLEMENTATION_VERSION = "1.68.2"; // CURRENT_GRPC_VERSION
|
||||
|
||||
/**
|
||||
* The default timeout in nanos for a keepalive ping request.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
bazel_dep(name = "googleapis", repo_name = "com_google_googleapis", version = "0.0.0-20240326-1c8d509c5")
|
||||
bazel_dep(name = "grpc-java", repo_name = "io_grpc_grpc_java", version = "1.66.0-SNAPSHOT") # CURRENT_GRPC_VERSION
|
||||
bazel_dep(name = "grpc-java", repo_name = "io_grpc_grpc_java", version = "1.68.2") # CURRENT_GRPC_VERSION
|
||||
bazel_dep(name = "grpc-proto", repo_name = "io_grpc_grpc_proto", version = "0.0.0-20240627-ec30f58")
|
||||
bazel_dep(name = "protobuf", repo_name = "com_google_protobuf", version = "23.1")
|
||||
bazel_dep(name = "rules_jvm_external", version = "6.0")
|
||||
|
|
|
@ -34,7 +34,7 @@ android {
|
|||
protobuf {
|
||||
protoc { artifact = 'com.google.protobuf:protoc:3.25.1' }
|
||||
plugins {
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.2' // CURRENT_GRPC_VERSION
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
|
@ -54,12 +54,12 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
|
||||
// You need to build grpc-java to obtain these libraries below.
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'org.apache.tomcat:annotations-api:6.0.53'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'com.google.truth:truth:1.1.5'
|
||||
testImplementation 'io.grpc:grpc-testing:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
testImplementation 'io.grpc:grpc-testing:1.68.2' // CURRENT_GRPC_VERSION
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ android {
|
|||
protobuf {
|
||||
protoc { artifact = 'com.google.protobuf:protoc:3.25.1' }
|
||||
plugins {
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.2' // CURRENT_GRPC_VERSION
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
|
@ -52,8 +52,8 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
|
||||
// You need to build grpc-java to obtain these libraries below.
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'org.apache.tomcat:annotations-api:6.0.53'
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ android {
|
|||
protobuf {
|
||||
protoc { artifact = 'com.google.protobuf:protoc:3.25.1' }
|
||||
plugins {
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.2' // CURRENT_GRPC_VERSION
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
|
@ -52,8 +52,8 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
|
||||
// You need to build grpc-java to obtain these libraries below.
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'org.apache.tomcat:annotations-api:6.0.53'
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ android {
|
|||
protobuf {
|
||||
protoc { artifact = 'com.google.protobuf:protoc:3.25.1' }
|
||||
plugins {
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.68.2' // CURRENT_GRPC_VERSION
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
|
@ -53,8 +53,8 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
|
||||
// You need to build grpc-java to obtain these libraries below.
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-okhttp:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-protobuf-lite:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'io.grpc:grpc-stub:1.68.2' // CURRENT_GRPC_VERSION
|
||||
implementation 'org.apache.tomcat:annotations-api:6.0.53'
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
def protocVersion = protobufVersion
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -25,7 +25,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-debug</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for jdk9 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -25,7 +25,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-dualstack</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for jdk9 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -24,7 +24,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
def protocVersion = protobufVersion
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-gauth</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protobuf.version>3.25.5</protobuf.version>
|
||||
<!-- required for jdk9 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -25,7 +25,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
def openTelemetryVersion = '1.40.0'
|
||||
def openTelemetryPrometheusVersion = '1.40.0-alpha'
|
||||
|
@ -34,6 +34,7 @@ dependencies {
|
|||
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
|
||||
implementation "io.grpc:grpc-stub:${grpcVersion}"
|
||||
implementation "io.grpc:grpc-gcp-csm-observability:${grpcVersion}"
|
||||
implementation "io.grpc:grpc-xds:${grpcVersion}"
|
||||
implementation "io.opentelemetry:opentelemetry-sdk:${openTelemetryVersion}"
|
||||
implementation "io.opentelemetry:opentelemetry-sdk-metrics:${openTelemetryVersion}"
|
||||
implementation "io.opentelemetry:opentelemetry-exporter-prometheus:${openTelemetryPrometheusVersion}"
|
||||
|
|
|
@ -25,6 +25,7 @@ import io.grpc.examples.helloworld.GreeterGrpc;
|
|||
import io.grpc.examples.helloworld.HelloReply;
|
||||
import io.grpc.examples.helloworld.HelloRequest;
|
||||
import io.grpc.gcp.csm.observability.CsmObservability;
|
||||
import io.grpc.xds.XdsChannelCredentials;
|
||||
import io.opentelemetry.exporter.prometheus.PrometheusHttpServer;
|
||||
import io.opentelemetry.sdk.OpenTelemetrySdk;
|
||||
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
||||
|
@ -127,8 +128,10 @@ public class CsmObservabilityClient {
|
|||
observability.registerGlobal();
|
||||
|
||||
// Create a communication channel to the server, known as a Channel.
|
||||
ManagedChannel channel = Grpc.newChannelBuilder(target, InsecureChannelCredentials.create())
|
||||
.build();
|
||||
ManagedChannel channel =
|
||||
Grpc.newChannelBuilder(
|
||||
target, XdsChannelCredentials.create(InsecureChannelCredentials.create()))
|
||||
.build();
|
||||
CsmObservabilityClient client = new CsmObservabilityClient(channel);
|
||||
|
||||
try {
|
||||
|
|
|
@ -24,6 +24,8 @@ import io.grpc.examples.helloworld.HelloReply;
|
|||
import io.grpc.examples.helloworld.HelloRequest;
|
||||
import io.grpc.gcp.csm.observability.CsmObservability;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import io.grpc.xds.XdsServerBuilder;
|
||||
import io.grpc.xds.XdsServerCredentials;
|
||||
import io.opentelemetry.exporter.prometheus.PrometheusHttpServer;
|
||||
import io.opentelemetry.sdk.OpenTelemetrySdk;
|
||||
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
||||
|
@ -40,10 +42,12 @@ public class CsmObservabilityServer {
|
|||
|
||||
private Server server;
|
||||
private void start(int port) throws IOException {
|
||||
server = Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create())
|
||||
.addService(new GreeterImpl())
|
||||
.build()
|
||||
.start();
|
||||
server =
|
||||
XdsServerBuilder.forPort(
|
||||
port, XdsServerCredentials.create(InsecureServerCredentials.create()))
|
||||
.addService(new GreeterImpl())
|
||||
.build()
|
||||
.start();
|
||||
logger.info("Server started, listening on " + port);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -23,7 +23,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-hostname</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for jdk9 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -23,7 +23,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
def protocVersion = protobufVersion
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-jwt-auth</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protobuf.version>3.25.5</protobuf.version>
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for jdk9 -->
|
||||
|
|
|
@ -23,7 +23,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protobufVersion = '3.25.5'
|
||||
def protocVersion = protobufVersion
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-oauth</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protobuf.version>3.25.5</protobuf.version>
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for jdk9 -->
|
||||
|
|
|
@ -24,7 +24,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
def openTelemetryVersion = '1.40.0'
|
||||
def openTelemetryPrometheusVersion = '1.40.0-alpha'
|
||||
|
|
|
@ -18,7 +18,7 @@ java {
|
|||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -18,7 +18,7 @@ java {
|
|||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -16,7 +16,7 @@ java {
|
|||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -24,7 +24,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>example-tls</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for jdk9 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -23,7 +23,7 @@ java {
|
|||
|
||||
// Feel free to delete the comment at the next line. It is just for safely
|
||||
// updating the version in our release process.
|
||||
def grpcVersion = '1.68.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
def grpcVersion = '1.68.2' // CURRENT_GRPC_VERSION
|
||||
def protocVersion = '3.25.5'
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<packaging>jar</packaging>
|
||||
<!-- Feel free to delete the comment at the end of these lines. It is just
|
||||
for safely updating the version in our release process. -->
|
||||
<version>1.68.0-SNAPSHOT</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<version>1.68.2</version><!-- CURRENT_GRPC_VERSION -->
|
||||
<name>examples</name>
|
||||
<url>https://github.com/grpc/grpc-java</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.68.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<grpc.version>1.68.2</grpc.version><!-- CURRENT_GRPC_VERSION -->
|
||||
<protobuf.version>3.25.5</protobuf.version>
|
||||
<protoc.version>3.25.5</protoc.version>
|
||||
<!-- required for JDK 8 -->
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
<!-- [START config] -->
|
||||
<appengine-web-app xmlns='http://appengine.google.com/ns/1.0'>
|
||||
<service>java-gae-interop-test</service>
|
||||
<runtime>java11</runtime>
|
||||
<runtime>java17</runtime>
|
||||
</appengine-web-app>
|
||||
<!-- [END config] -->
|
||||
|
|
|
@ -515,21 +515,6 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
|
|||
serializingExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// This is a hack to make sure the connection preface and initial settings to be sent out
|
||||
// without blocking the start. By doing this essentially prevents potential deadlock when
|
||||
// network is not available during startup while another thread holding lock to send the
|
||||
// initial preface.
|
||||
try {
|
||||
latch.await();
|
||||
barrier.await(1000, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (TimeoutException | BrokenBarrierException e) {
|
||||
startGoAway(0, ErrorCode.INTERNAL_ERROR, Status.UNAVAILABLE
|
||||
.withDescription("Timed out waiting for second handshake thread. "
|
||||
+ "The transport executor pool may have run out of threads"));
|
||||
return;
|
||||
}
|
||||
// Use closed source on failure so that the reader immediately shuts down.
|
||||
BufferedSource source = Okio.buffer(new Source() {
|
||||
@Override
|
||||
|
@ -549,6 +534,22 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
|
|||
Socket sock;
|
||||
SSLSession sslSession = null;
|
||||
try {
|
||||
// This is a hack to make sure the connection preface and initial settings to be sent out
|
||||
// without blocking the start. By doing this essentially prevents potential deadlock when
|
||||
// network is not available during startup while another thread holding lock to send the
|
||||
// initial preface.
|
||||
try {
|
||||
latch.await();
|
||||
barrier.await(1000, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (TimeoutException | BrokenBarrierException e) {
|
||||
startGoAway(0, ErrorCode.INTERNAL_ERROR, Status.UNAVAILABLE
|
||||
.withDescription("Timed out waiting for second handshake thread. "
|
||||
+ "The transport executor pool may have run out of threads"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (proxiedAddr == null) {
|
||||
sock = socketFactory.createSocket(address.getAddress(), address.getPort());
|
||||
} else {
|
||||
|
@ -1459,4 +1460,4 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
|
|||
// TODO(madongfly): Deal with alternateService propagation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -335,7 +335,6 @@ public final class ServerCalls {
|
|||
private boolean aborted = false;
|
||||
private boolean completed = false;
|
||||
private Runnable onCloseHandler;
|
||||
private RespT unaryResponse;
|
||||
|
||||
// Non private to avoid synthetic class
|
||||
ServerCallStreamObserverImpl(ServerCall<ReqT, RespT> call, boolean serverStreamingOrBidi) {
|
||||
|
@ -374,22 +373,15 @@ public final class ServerCalls {
|
|||
}
|
||||
checkState(!aborted, "Stream was terminated by error, no further calls are allowed");
|
||||
checkState(!completed, "Stream is already completed, no further calls are allowed");
|
||||
if (serverStreamingOrBidi) {
|
||||
if (!sentHeaders) {
|
||||
call.sendHeaders(new Metadata());
|
||||
sentHeaders = true;
|
||||
}
|
||||
call.sendMessage(response);
|
||||
} else {
|
||||
unaryResponse = response;
|
||||
if (!sentHeaders) {
|
||||
call.sendHeaders(new Metadata());
|
||||
sentHeaders = true;
|
||||
}
|
||||
call.sendMessage(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
if (!serverStreamingOrBidi) {
|
||||
unaryResponse = null;
|
||||
}
|
||||
Metadata metadata = Status.trailersFromThrowable(t);
|
||||
if (metadata == null) {
|
||||
metadata = new Metadata();
|
||||
|
@ -400,14 +392,6 @@ public final class ServerCalls {
|
|||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
if (!serverStreamingOrBidi && unaryResponse != null) {
|
||||
if (!sentHeaders) {
|
||||
call.sendHeaders(new Metadata());
|
||||
sentHeaders = true;
|
||||
}
|
||||
call.sendMessage(unaryResponse);
|
||||
unaryResponse = null;
|
||||
}
|
||||
call.close(Status.OK, new Metadata());
|
||||
completed = true;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import io.grpc.ServerCallHandler;
|
|||
import io.grpc.ServerServiceDefinition;
|
||||
import io.grpc.ServiceDescriptor;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.Status.Code;
|
||||
import io.grpc.StatusRuntimeException;
|
||||
import io.grpc.inprocess.InProcessChannelBuilder;
|
||||
import io.grpc.inprocess.InProcessServerBuilder;
|
||||
|
@ -621,59 +620,6 @@ public class ServerCallsTest {
|
|||
assertArrayEquals(new int[]{0, 1, 1, 2, 2, 2}, receivedMessages);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serverUnaryResponseMsgWithOkStatus() {
|
||||
ServerCallHandler<Integer, Integer> serverCallHandler =
|
||||
ServerCalls.asyncUnaryCall(
|
||||
new ServerCalls.UnaryMethod<Integer, Integer>() {
|
||||
@Override
|
||||
public void invoke(Integer request, StreamObserver<Integer> responseObserver) {
|
||||
responseObserver.onNext(request);
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
});
|
||||
ServerCall.Listener<Integer> callListener =
|
||||
serverCallHandler.startCall(serverCall, new Metadata());
|
||||
serverCall.isReady = true;
|
||||
serverCall.isCancelled = false;
|
||||
callListener.onReady();
|
||||
callListener.onMessage(1);
|
||||
callListener.onHalfClose();
|
||||
|
||||
assertThat(serverCall.status.getCode()).isEqualTo(Code.OK);
|
||||
assertThat(serverCall.responses).containsExactly(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serverUnaryResponseMsgWithNotOkStatus() {
|
||||
ServerCallHandler<Integer, Integer> serverCallHandler =
|
||||
ServerCalls.asyncUnaryCall(
|
||||
new ServerCalls.UnaryMethod<Integer, Integer>() {
|
||||
@Override
|
||||
public void invoke(Integer request, StreamObserver<Integer> responseObserver) {
|
||||
responseObserver.onNext(request);
|
||||
responseObserver.onError(
|
||||
Status.INTERNAL
|
||||
.withDescription("Response message is null for unary call")
|
||||
.asRuntimeException());
|
||||
}
|
||||
});
|
||||
|
||||
ServerCall.Listener<Integer> callListener =
|
||||
serverCallHandler.startCall(serverCall, new Metadata());
|
||||
|
||||
serverCall.isReady = true;
|
||||
serverCall.isCancelled = false;
|
||||
callListener.onReady();
|
||||
callListener.onMessage(1);
|
||||
callListener.onHalfClose();
|
||||
|
||||
assertThat(serverCall.status.getCode()).isEqualTo(Code.INTERNAL);
|
||||
assertThat(serverCall.status.getDescription())
|
||||
.isEqualTo("Response message is null for unary call");
|
||||
assertThat(serverCall.responses).isEmpty();
|
||||
}
|
||||
|
||||
public static class IntegerMarshaller implements MethodDescriptor.Marshaller<Integer> {
|
||||
@Override
|
||||
public InputStream stream(Integer value) {
|
||||
|
|
Loading…
Reference in New Issue