Skip to content

Commit 136665f

Browse files
authored
api,stub:Stabilize part of compression agreed to in the stabilization meeting (#9942)
* api,stub:Stabilize part of compression agreed to in the stabilization meeting. addresses part of #1704
1 parent 7ecb909 commit 136665f

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,12 @@ public CallOptions withCallCredentials(@Nullable CallCredentials credentials) {
138138

139139
/**
140140
* Sets the compression to use for the call. The compressor must be a valid name known in the
141-
* {@link CompressorRegistry}.
141+
* {@link CompressorRegistry}. By default, the "gzip" compressor will be available.
142142
*
143143
* <p>It is only safe to call this if the server supports the compression format chosen. There is
144144
* no negotiation performed; if the server does not support the compression chosen, the call will
145145
* fail.
146146
*/
147-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
148147
public CallOptions withCompression(@Nullable String compressorName) {
149148
Builder builder = toBuilder(this);
150149
builder.compressorName = compressorName;
@@ -207,7 +206,6 @@ public CallOptions withoutWaitForReady() {
207206
/**
208207
* Returns the compressor's name.
209208
*/
210-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
211209
@Nullable
212210
public String getCompressor() {
213211
return compressorName;

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,24 +189,22 @@ public boolean isReady() {
189189
* encoding has been negotiated, this is a no-op. By default per-message compression is enabled,
190190
* but may not have any effect if compression is not enabled on the call.
191191
*/
192-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
193192
public void setMessageCompression(boolean enabled) {
194193
// noop
195194
}
196195

197196
/**
198-
* Sets the compression algorithm for this call. If the server does not support the compression
199-
* algorithm, the call will fail. This method may only be called before {@link #sendHeaders}.
200-
* The compressor to use will be looked up in the {@link CompressorRegistry}. Default gRPC
201-
* servers support the "gzip" compressor.
197+
* Sets the compression algorithm for this call. This compression is utilized for sending. If
198+
* the server does not support the compression algorithm, the call will fail. This method may
199+
* only be called before {@link #sendHeaders}. The compressor to use will be looked up in the
200+
* {@link CompressorRegistry}. Default gRPC servers support the "gzip" compressor.
202201
*
203202
* <p>It is safe to call this even if the client does not support the compression format chosen.
204203
* The implementation will handle negotiation with the client and may fall back to no compression.
205204
*
206205
* @param compressor the name of the compressor to use.
207206
* @throws IllegalArgumentException if the compressor name can not be found.
208207
*/
209-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
210208
public void setCompression(String compressor) {
211209
// noop
212210
}

stub/src/main/java/io/grpc/stub/AbstractStub.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,11 @@ public final S withExecutor(Executor executor) {
163163
/**
164164
* Set's the compressor name to use for the call. It is the responsibility of the application
165165
* to make sure the server supports decoding the compressor picked by the client. To be clear,
166-
* this is the compressor used by the stub to compress messages to the server. To get
167-
* compressed responses from the server, set the appropriate {@link io.grpc.DecompressorRegistry}
168-
* on the {@link io.grpc.ManagedChannelBuilder}.
166+
* this is the compressor used by the stub to compress messages to the server.
169167
*
170168
* @since 1.0.0
171169
* @param compressorName the name (e.g. "gzip") of the compressor to use.
172170
*/
173-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
174171
public final S withCompression(String compressorName) {
175172
return build(channel, callOptions.withCompression(compressorName));
176173
}

0 commit comments

Comments
 (0)