Skip to content

Commit 542f840

Browse files
committed
Merge remote-tracking branch 'origin/master' into server-framework-custom-events
2 parents d5f0182 + d51ec50 commit 542f840

61 files changed

Lines changed: 2813 additions & 244 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/branch-testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020
fail-fast: false # Should swap to true if we grow a large matrix
2121

2222
steps:
23-
- uses: actions/checkout@v6
23+
- uses: actions/checkout@v7
2424
- uses: actions/setup-java@v5
2525
with:
2626
java-version: ${{ matrix.jre }}
2727
distribution: 'temurin'
2828

2929
- name: Gradle cache
30-
uses: actions/cache@v5
30+
uses: actions/cache@v6
3131
with:
3232
path: |
3333
~/.gradle/caches

.github/workflows/gradle-wrapper-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ jobs:
99
name: "Gradle wrapper validation"
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v6
12+
- uses: actions/checkout@v7
1313
- uses: gradle/actions/wrapper-validation@v6

.github/workflows/testing.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ jobs:
2121
fail-fast: false # Should swap to true if we grow a large matrix
2222

2323
steps:
24-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@v7
2525
- uses: actions/setup-java@v5
2626
with:
2727
java-version: ${{ matrix.jre }}
2828
distribution: 'temurin'
2929

3030
- name: Gradle cache
31-
uses: actions/cache@v5
31+
uses: actions/cache@v6
3232
with:
3333
path: |
3434
~/.gradle/caches
@@ -37,7 +37,7 @@ jobs:
3737
restore-keys: |
3838
${{ runner.os }}-gradle-
3939
- name: Maven cache
40-
uses: actions/cache@v5
40+
uses: actions/cache@v6
4141
with:
4242
path: |
4343
~/.m2/repository
@@ -46,7 +46,7 @@ jobs:
4646
restore-keys: |
4747
${{ runner.os }}-maven-
4848
- name: Protobuf cache
49-
uses: actions/cache@v5
49+
uses: actions/cache@v6
5050
with:
5151
path: /tmp/protobuf-cache
5252
key: ${{ runner.os }}-maven-${{ hashFiles('buildscripts/make_dependencies.sh') }}
@@ -71,7 +71,7 @@ jobs:
7171
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
7272
run: ./gradlew :grpc-all:coveralls -PskipAndroid=true -x compileJava
7373
- name: Codecov
74-
uses: codecov/codecov-action@v6
74+
uses: codecov/codecov-action@v7
7575
with:
7676
token: ${{ secrets.CODECOV_TOKEN }}
7777

@@ -88,15 +88,15 @@ jobs:
8888
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
8989

9090
steps:
91-
- uses: actions/checkout@v6
91+
- uses: actions/checkout@v7
9292

9393
- name: Check versions match in MODULE.bazel and repositories.bzl
9494
run: |
9595
diff -u <(sed -n '/GRPC_DEPS_START/,/GRPC_DEPS_END/ {/GRPC_DEPS_/! p}' MODULE.bazel) \
9696
<(sed -n '/GRPC_DEPS_START/,/GRPC_DEPS_END/ {/GRPC_DEPS_/! p}' repositories.bzl)
9797
9898
- name: Bazel cache
99-
uses: actions/cache@v5
99+
uses: actions/cache@v6
100100
with:
101101
path: |
102102
~/.cache/bazel/*/cache

MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
2020
"com.google.re2j:re2j:1.8",
2121
"com.google.s2a.proto.v2:s2a-proto:0.1.3",
2222
"com.google.truth:truth:1.4.5",
23-
"dev.cel:runtime:0.13.0",
24-
"dev.cel:protobuf:0.13.0",
25-
"dev.cel:common:0.13.0",
23+
"dev.cel:runtime:0.13.1",
24+
"dev.cel:protobuf:0.13.1",
25+
"dev.cel:common:0.13.1",
2626
"com.squareup.okhttp:okhttp:2.7.5",
2727
"com.squareup.okio:okio:2.10.0", # 3.0+ needs swapping to -jvm; need work to avoid flag-day
2828
"io.netty:netty-buffer:4.2.15.Final",

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ For a guided tour, take a look at the [quick start
4444
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
4545
basics](https://grpc.io/docs/languages/java/basics).
4646

47-
The [examples](https://github.com/grpc/grpc-java/tree/v1.82.1/examples) and the
48-
[Android example](https://github.com/grpc/grpc-java/tree/v1.82.1/examples/android)
47+
The [examples](https://github.com/grpc/grpc-java/tree/v1.83.1/examples) and the
48+
[Android example](https://github.com/grpc/grpc-java/tree/v1.83.1/examples/android)
4949
are standalone projects that showcase the usage of gRPC.
5050

5151
Download
@@ -56,42 +56,42 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
5656
<dependency>
5757
<groupId>io.grpc</groupId>
5858
<artifactId>grpc-netty-shaded</artifactId>
59-
<version>1.82.1</version>
59+
<version>1.83.1</version>
6060
<scope>runtime</scope>
6161
</dependency>
6262
<dependency>
6363
<groupId>io.grpc</groupId>
6464
<artifactId>grpc-protobuf</artifactId>
65-
<version>1.82.1</version>
65+
<version>1.83.1</version>
6666
</dependency>
6767
<dependency>
6868
<groupId>io.grpc</groupId>
6969
<artifactId>grpc-stub</artifactId>
70-
<version>1.82.1</version>
70+
<version>1.83.1</version>
7171
</dependency>
7272
```
7373

7474
Or for Gradle with non-Android, add to your dependencies:
7575
```gradle
76-
runtimeOnly 'io.grpc:grpc-netty-shaded:1.82.1'
77-
implementation 'io.grpc:grpc-protobuf:1.82.1'
78-
implementation 'io.grpc:grpc-stub:1.82.1'
76+
runtimeOnly 'io.grpc:grpc-netty-shaded:1.83.1'
77+
implementation 'io.grpc:grpc-protobuf:1.83.1'
78+
implementation 'io.grpc:grpc-stub:1.83.1'
7979
```
8080

8181
For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
8282
`grpc-protobuf-lite` instead of `grpc-protobuf`:
8383
```gradle
84-
implementation 'io.grpc:grpc-okhttp:1.82.1'
85-
implementation 'io.grpc:grpc-protobuf-lite:1.82.1'
86-
implementation 'io.grpc:grpc-stub:1.82.1'
84+
implementation 'io.grpc:grpc-okhttp:1.83.1'
85+
implementation 'io.grpc:grpc-protobuf-lite:1.83.1'
86+
implementation 'io.grpc:grpc-stub:1.83.1'
8787
```
8888

8989
For [Bazel](https://bazel.build), you can either
9090
[use Maven](https://github.com/bazelbuild/rules_jvm_external)
9191
(with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below).
9292

9393
[the JARs]:
94-
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.82.1
94+
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.83.1
9595

9696
Development snapshots are available in [Sonatypes's snapshot
9797
repository](https://central.sonatype.com/repository/maven-snapshots/).
@@ -123,7 +123,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
123123
<configuration>
124124
<protocArtifact>com.google.protobuf:protoc:3.25.8:exe:${os.detected.classifier}</protocArtifact>
125125
<pluginId>grpc-java</pluginId>
126-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.82.1:exe:${os.detected.classifier}</pluginArtifact>
126+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.83.1:exe:${os.detected.classifier}</pluginArtifact>
127127
</configuration>
128128
<executions>
129129
<execution>
@@ -153,7 +153,7 @@ protobuf {
153153
}
154154
plugins {
155155
grpc {
156-
artifact = 'io.grpc:protoc-gen-grpc-java:1.82.1'
156+
artifact = 'io.grpc:protoc-gen-grpc-java:1.83.1'
157157
}
158158
}
159159
generateProtoTasks {
@@ -186,7 +186,7 @@ protobuf {
186186
}
187187
plugins {
188188
grpc {
189-
artifact = 'io.grpc:protoc-gen-grpc-java:1.82.1'
189+
artifact = 'io.grpc:protoc-gen-grpc-java:1.83.1'
190190
}
191191
}
192192
generateProtoTasks {

api/build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ sourceSets {
1717
}
1818

1919
tasks.named("compileContextJava").configure {
20-
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_20)) {
21-
println("!!! Javac does not support generating Java 7 bytecode. Do not use for release builds !!!")
22-
} else if (JavaVersion.current().isJava9Compatible()) {
23-
options.release = 7
20+
if (JavaVersion.current().isJava9Compatible()) {
21+
options.release = 8
2422
} else {
25-
sourceCompatibility = JavaVersion.VERSION_1_7
26-
targetCompatibility = JavaVersion.VERSION_1_7
23+
sourceCompatibility = JavaVersion.VERSION_1_8
24+
targetCompatibility = JavaVersion.VERSION_1_8
2725
}
2826
}
2927

api/src/main/java/io/grpc/ClientInterceptor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
* CallCredentials}. But a {@code ClientInterceptor} could set the {@code
3333
* CallCredentials} within the {@link CallOptions}.
3434
*
35+
* <p>From gRPC's perspective, interceptors don't generally exist and are more of a convenience.
36+
* Convenience APIs will use {@link ClientInterceptors} to convert the interceptor into a {@code
37+
* Channel}. Thus interceptors are an extension of the application and run on the same
38+
* threads and receive callbacks using the same executor.
39+
*
3540
* <p>The interceptor may be called for multiple {@link ClientCall calls} by one or more threads
3641
* without completing the previous ones first. Refer to the
3742
* {@link io.grpc.ClientCall.Listener ClientCall.Listener} docs for more details regarding thread

api/src/main/java/io/grpc/ManagedChannelBuilder.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ public static ManagedChannelBuilder<?> forTarget(String target) {
9292
}
9393

9494
/**
95-
* Execute application code directly in the transport thread.
96-
*
97-
* <p>Depending on the underlying transport, using a direct executor may lead to substantial
98-
* performance improvements. However, it also requires the application to not block under
95+
* Execute application code directly in the transport thread. The application must not block under
9996
* any circumstances.
10097
*
98+
* <p>Depending on the underlying transport and the application code, using a direct executor may
99+
* lead to 10s of µs latency reduction but causes a substantial performance degradation when
100+
* misused.
101+
*
101102
* <p>Calling this method is semantically equivalent to calling {@link #executor(Executor)} and
102103
* passing in a direct executor. However, this is the preferred way as it may allow the transport
103104
* to perform special optimizations.
@@ -108,7 +109,10 @@ public static ManagedChannelBuilder<?> forTarget(String target) {
108109
public abstract T directExecutor();
109110

110111
/**
111-
* Provides a custom executor.
112+
* Set the default executor for callbacks. This is used for async and future stub callbacks, but
113+
* can be overridden by {@link CallOptions#withExecutor} and {@code stub.withExecutor()}. Blocking
114+
* stubs specify a per-RPC executor. This is also used for {@link
115+
* ManagedChannel#notifyWhenStateChanged}.
112116
*
113117
* <p>It's an optional parameter. If the user has not provided an executor when the channel is
114118
* built, the builder will use a static cached thread pool.

api/src/main/java/io/grpc/ServerBuilder.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ public static ServerBuilder<?> forPort(int port) {
4545
}
4646

4747
/**
48-
* Execute application code directly in the transport thread.
49-
*
50-
* <p>Depending on the underlying transport, using a direct executor may lead to substantial
51-
* performance improvements. However, it also requires the application to not block under
48+
* Execute application code directly in the transport thread. The application must not block under
5249
* any circumstances.
5350
*
51+
* <p>Depending on the underlying transport and the application code, using a direct executor may
52+
* lead to 10s of µs latency reduction but causes a substantial performance degradation when
53+
* misused.
54+
*
5455
* <p>Calling this method is semantically equivalent to calling {@link #executor(Executor)} and
5556
* passing in a direct executor. However, this is the preferred way as it may allow the transport
5657
* to perform special optimizations.
@@ -61,10 +62,11 @@ public static ServerBuilder<?> forPort(int port) {
6162
public abstract T directExecutor();
6263

6364
/**
64-
* Provides a custom executor.
65+
* Set the default executor for service callbacks.
6566
*
6667
* <p>It's an optional parameter. If the user has not provided an executor when the server is
67-
* built, the builder will use a static cached thread pool.
68+
* built, the builder will use a static cached thread pool. Users are encouraged to specify their
69+
* own executor that limits the number of threads.
6870
*
6971
* <p>The server won't take ownership of the given executor. It's caller's responsibility to
7072
* shut down the executor when it's desired.
@@ -85,11 +87,13 @@ public static ServerBuilder<?> forPort(int port) {
8587
* it switches over. But if calling {@link ServerCallExecutorSupplier} returns null, the server
8688
* call is still handled by the default {@link #executor(Executor)} as a fallback.
8789
*
90+
* <p>If your {@code executorSupplier} runs quickly and always returns a non-{@code null}
91+
* executor, then you may want to use {@link #directExecutor} to reduce latency.
92+
*
8893
* @param executorSupplier the server call executor provider
8994
* @return this
9095
* @since 1.39.0
91-
*
92-
* */
96+
*/
9397
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8274")
9498
public T callExecutor(ServerCallExecutorSupplier executorSupplier) {
9599
return thisT();

api/src/main/java/io/grpc/ServerInterceptor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
* <li>Delegating calls to other servers</li>
3030
* </ul>
3131
*
32+
* <p>From gRPC's perspective, interceptors don't generally exist and are more of a convenience.
33+
* Convenience APIs will use {@link ServerInterceptors} to convert the interceptor into a {@code
34+
* ServerCallHandler}. Thus interceptors are an extension of the application and run on the same
35+
* threads and receive callbacks using the same executor.
36+
*
3237
* <p>The interceptor may be called for multiple {@link ServerCall calls} by one or more threads
3338
* without completing the previous ones first. Refer to the
3439
* {@link io.grpc.ServerCall.Listener ServerCall.Listener} docs for more details regarding thread

0 commit comments

Comments
 (0)