Name Date Size #Lines LOC

..--

.github/H25-Apr-2025-182145

all/H25-Apr-2025-7867

alts/H25-Apr-2025-12,0178,256

android/H25-Apr-2025-1,301944

android-interop-testing/H25-Apr-2025-6,9934,925

annotation-stubs/H25-Apr-2025-132104

api/H25-Apr-2025-24,80713,171

auth/H25-Apr-2025-1,3601,011

authz/H25-Apr-2025-1,9851,723

benchmarks/H25-Apr-2025-7,1365,262

binder/H25-Apr-2025-11,4947,701

bom/H25-Apr-2025-4742

buildscripts/H25-Apr-2025-2,4481,520

census/H25-Apr-2025-3,6402,948

compiler/H25-Apr-2025-4,4643,886

context/H25-Apr-2025-4,1002,701

core/H25-Apr-2025-70,26851,119

cronet/H25-Apr-2025-2,8492,138

documentation/H25-Apr-2025-610489

examples/H25-Apr-2025-18,49613,389

gae-interop-testing/H25-Apr-2025-517394

gcp-observability/H25-Apr-2025-6,5925,236

googleapis/H25-Apr-2025-911721

gradle/H25-Apr-2025-8279

grpclb/H25-Apr-2025-7,1005,292

interop-testing/H25-Apr-2025-15,69912,099

istio-interop-testing/H25-Apr-2025-1,6871,359

netty/H25-Apr-2025-25,30018,470

okhttp/H25-Apr-2025-21,54315,425

protobuf/H25-Apr-2025-742395

protobuf-lite/H25-Apr-2025-917664

rls/H25-Apr-2025-7,3825,483

services/H25-Apr-2025-15,03711,497

servlet/H25-Apr-2025-3,1552,261

stub/H25-Apr-2025-5,0623,140

testing/H25-Apr-2025-4,0092,669

testing-proto/H25-Apr-2025-772565

xds/H25-Apr-2025-99,34079,862

.bazelignoreH A D25-Apr-2025130 43

.bazelrcH A D25-Apr-202551 21

.gitattributesH A D25-Apr-2025136 54

.gitignoreH A D25-Apr-2025399 4536

AUTHORSH A D25-Apr-202512 21

Android.bpH A D25-Apr-20253.3 KiB129121

BUILD.bazelH A D25-Apr-20252 KiB7264

CODE-OF-CONDUCT.mdH A D25-Apr-2025138 42

COMPILING.mdH A D25-Apr-20255.9 KiB153126

CONTRIBUTING.mdH A D25-Apr-20254.6 KiB8854

GOVERNANCE.mdH A D25-Apr-2025141 21

LICENSEH A D25-Apr-202511.1 KiB203169

MAINTAINERS.mdH A D25-Apr-20251.7 KiB3531

METADATAH A D25-Apr-2025314 1715

NOTICE.txtH A D25-Apr-20252 KiB6350

OWNERSH A D25-Apr-202558 43

README.mdH A D25-Apr-20259.5 KiB280232

RELEASING.mdH A D25-Apr-20259.6 KiB237197

SECURITY.mdH A D25-Apr-202518.4 KiB428339

WORKSPACEH A D25-Apr-20251.5 KiB4834

build.gradleH A D25-Apr-202522.6 KiB578524

codecov.ymlH A D25-Apr-2025245 1514

gradlewH A D25-Apr-20257.9 KiB23598

gradlew.batH A D25-Apr-20252.7 KiB9068

java_grpc_library.bzlH A D25-Apr-20256.9 KiB209189

repositories.bzlH A D25-Apr-20257.3 KiB165157

run-test-client.shH A D25-Apr-2025295 1210

run-test-server.shH A D25-Apr-2025295 1210

settings.gradleH A D25-Apr-20254.9 KiB115110

README.md

1gRPC-Java - An RPC library and framework
2========================================
3
4<table>
5  <tr>
6    <td><b>Homepage:</b></td>
7    <td><a href="https://grpc.io/">grpc.io</a></td>
8  </tr>
9  <tr>
10    <td><b>Mailing List:</b></td>
11    <td><a href="https://groups.google.com/forum/#!forum/grpc-io">[email protected]</a></td>
12  </tr>
13</table>
14
15[![Join the chat at https://gitter.im/grpc/grpc](https://badges.gitter.im/grpc/grpc.svg)](https://gitter.im/grpc/grpc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16[![Build Status](https://travis-ci.org/grpc/grpc-java.svg?branch=master)](https://travis-ci.org/grpc/grpc-java)
17[![Line Coverage Status](https://coveralls.io/repos/grpc/grpc-java/badge.svg?branch=master&service=github)](https://coveralls.io/github/grpc/grpc-java?branch=master)
18[![Branch-adjusted Line Coverage Status](https://codecov.io/gh/grpc/grpc-java/branch/master/graph/badge.svg)](https://codecov.io/gh/grpc/grpc-java)
19
20Supported Platforms
21-------------------
22
23gRPC-Java supports Java 8 and later. Android minSdkVersion 19 (KitKat) and
24later are supported with [Java 8 language desugaring][android-java-8].
25
26TLS usage on Android typically requires Play Services Dynamic Security Provider.
27Please see the [Security Readme](SECURITY.md).
28
29Older Java versions are not directly supported, but a branch remains available
30for fixes and releases. See [gRFC P5 JDK Version Support
31Policy][P5-jdk-version-support].
32
33Java version | gRPC Branch
34------------ | -----------
357            | 1.41.x
36
37[android-java-8]: https://developer.android.com/studio/write/java8-support#supported_features
38[P5-jdk-version-support]: https://github.com/grpc/proposal/blob/master/P5-jdk-version-support.md#proposal
39
40Getting Started
41---------------
42
43For a guided tour, take a look at the [quick start
44guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
45basics](https://grpc.io/docs/languages/java/basics).
46
47The [examples](https://github.com/grpc/grpc-java/tree/v1.56.0/examples) and the
48[Android example](https://github.com/grpc/grpc-java/tree/v1.56.0/examples/android)
49are standalone projects that showcase the usage of gRPC.
50
51Download
52--------
53
54Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
55```xml
56<dependency>
57  <groupId>io.grpc</groupId>
58  <artifactId>grpc-netty-shaded</artifactId>
59  <version>1.56.0</version>
60  <scope>runtime</scope>
61</dependency>
62<dependency>
63  <groupId>io.grpc</groupId>
64  <artifactId>grpc-protobuf</artifactId>
65  <version>1.56.0</version>
66</dependency>
67<dependency>
68  <groupId>io.grpc</groupId>
69  <artifactId>grpc-stub</artifactId>
70  <version>1.56.0</version>
71</dependency>
72<dependency> <!-- necessary for Java 9+ -->
73  <groupId>org.apache.tomcat</groupId>
74  <artifactId>annotations-api</artifactId>
75  <version>6.0.53</version>
76  <scope>provided</scope>
77</dependency>
78```
79
80Or for Gradle with non-Android, add to your dependencies:
81```gradle
82runtimeOnly 'io.grpc:grpc-netty-shaded:1.56.0'
83implementation 'io.grpc:grpc-protobuf:1.56.0'
84implementation 'io.grpc:grpc-stub:1.56.0'
85compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
86```
87
88For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
89`grpc-protobuf-lite` instead of `grpc-protobuf`:
90```gradle
91implementation 'io.grpc:grpc-okhttp:1.56.0'
92implementation 'io.grpc:grpc-protobuf-lite:1.56.0'
93implementation 'io.grpc:grpc-stub:1.56.0'
94compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
95```
96
97For [Bazel](https://bazel.build), you can either
98[use Maven](https://github.com/bazelbuild/rules_jvm_external)
99(with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below).
100
101[the JARs]:
102https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.56.0
103
104Development snapshots are available in [Sonatypes's snapshot
105repository](https://oss.sonatype.org/content/repositories/snapshots/).
106
107Generated Code
108--------------
109
110For protobuf-based codegen, you can put your proto files in the `src/main/proto`
111and `src/test/proto` directories along with an appropriate plugin.
112
113For protobuf-based codegen integrated with the Maven build system, you can use
114[protobuf-maven-plugin][] (Eclipse and NetBeans users should also look at
115`os-maven-plugin`'s
116[IDE documentation](https://github.com/trustin/os-maven-plugin#issues-with-eclipse-m2e-or-other-ides)):
117```xml
118<build>
119  <extensions>
120    <extension>
121      <groupId>kr.motd.maven</groupId>
122      <artifactId>os-maven-plugin</artifactId>
123      <version>1.7.1</version>
124    </extension>
125  </extensions>
126  <plugins>
127    <plugin>
128      <groupId>org.xolstice.maven.plugins</groupId>
129      <artifactId>protobuf-maven-plugin</artifactId>
130      <version>0.6.1</version>
131      <configuration>
132        <protocArtifact>com.google.protobuf:protoc:3.22.3:exe:${os.detected.classifier}</protocArtifact>
133        <pluginId>grpc-java</pluginId>
134        <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.56.0:exe:${os.detected.classifier}</pluginArtifact>
135      </configuration>
136      <executions>
137        <execution>
138          <goals>
139            <goal>compile</goal>
140            <goal>compile-custom</goal>
141          </goals>
142        </execution>
143      </executions>
144    </plugin>
145  </plugins>
146</build>
147```
148
149[protobuf-maven-plugin]: https://www.xolstice.org/protobuf-maven-plugin/
150
151For non-Android protobuf-based codegen integrated with the Gradle build system,
152you can use [protobuf-gradle-plugin][]:
153```gradle
154plugins {
155    id 'com.google.protobuf' version '0.9.1'
156}
157
158protobuf {
159  protoc {
160    artifact = "com.google.protobuf:protoc:3.22.3"
161  }
162  plugins {
163    grpc {
164      artifact = 'io.grpc:protoc-gen-grpc-java:1.56.0'
165    }
166  }
167  generateProtoTasks {
168    all()*.plugins {
169      grpc {}
170    }
171  }
172}
173```
174
175[protobuf-gradle-plugin]: https://github.com/google/protobuf-gradle-plugin
176
177The prebuilt protoc-gen-grpc-java binary uses glibc on Linux. If you are
178compiling on Alpine Linux, you may want to use the [Alpine grpc-java package][]
179which uses musl instead.
180
181[Alpine grpc-java package]: https://pkgs.alpinelinux.org/package/edge/community/x86_64/grpc-java
182
183For Android protobuf-based codegen integrated with the Gradle build system, also
184use protobuf-gradle-plugin but specify the 'lite' options:
185
186```gradle
187plugins {
188    id 'com.google.protobuf' version '0.9.1'
189}
190
191protobuf {
192  protoc {
193    artifact = "com.google.protobuf:protoc:3.22.3"
194  }
195  plugins {
196    grpc {
197      artifact = 'io.grpc:protoc-gen-grpc-java:1.56.0'
198    }
199  }
200  generateProtoTasks {
201    all().each { task ->
202      task.builtins {
203        java { option 'lite' }
204      }
205      task.plugins {
206        grpc { option 'lite' }
207      }
208    }
209  }
210}
211
212```
213
214For [Bazel](https://bazel.build), use the [`proto_library`](https://github.com/bazelbuild/rules_proto)
215and the [`java_proto_library`](https://bazel.build/reference/be/java#java_proto_library) (no `load()` required)
216and `load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")` (from this project), as in
217[this example `BUILD.bazel`](https://github.com/grpc/grpc-java/blob/master/examples/BUILD.bazel).
218
219API Stability
220-------------
221
222APIs annotated with `@Internal` are for internal use by the gRPC library and
223should not be used by gRPC users. APIs annotated with `@ExperimentalApi` are
224subject to change in future releases, and library code that other projects
225may depend on should not use these APIs.
226
227We recommend using the
228[grpc-java-api-checker](https://github.com/grpc/grpc-java-api-checker)
229(an [Error Prone](https://github.com/google/error-prone) plugin)
230to check for usages of `@ExperimentalApi` and `@Internal` in any library code
231that depends on gRPC. It may also be used to check for `@Internal` usage or
232unintended `@ExperimentalApi` consumption in non-library code.
233
234How to Build
235------------
236
237If you are making changes to gRPC-Java, see the [compiling
238instructions](COMPILING.md).
239
240High-level Components
241---------------------
242
243At a high level there are three distinct layers to the library: *Stub*,
244*Channel*, and *Transport*.
245
246### Stub
247
248The Stub layer is what is exposed to most developers and provides type-safe
249bindings to whatever datamodel/IDL/interface you are adapting. gRPC comes with
250a [plugin](https://github.com/google/grpc-java/blob/master/compiler) to the
251protocol-buffers compiler that generates Stub interfaces out of `.proto` files,
252but bindings to other datamodel/IDL are easy and encouraged.
253
254### Channel
255
256The Channel layer is an abstraction over Transport handling that is suitable for
257interception/decoration and exposes more behavior to the application than the
258Stub layer. It is intended to be easy for application frameworks to use this
259layer to address cross-cutting concerns such as logging, monitoring, auth, etc.
260
261### Transport
262
263The Transport layer does the heavy lifting of putting and taking bytes off the
264wire. The interfaces to it are abstract just enough to allow plugging in of
265different implementations. Note the transport layer API is considered internal
266to gRPC and has weaker API guarantees than the core API under package `io.grpc`.
267
268gRPC comes with multiple Transport implementations:
269
2701. The Netty-based HTTP/2 transport is the main transport implementation based
271   on [Netty](https://netty.io). It is not officially supported on Android.
2722. The OkHttp-based HTTP/2 transport is a lightweight transport based on
273   [Okio](https://square.github.io/okio/) and forked low-level parts of
274   [OkHttp](https://square.github.io/okhttp/). It is mainly for use on Android.
2753. The in-process transport is for when a server is in the same process as the
276   client. It is used frequently for testing, while also being safe for
277   production use.
2784. The Binder transport is for Android cross-process communication on a single
279   device.
280