Skip to content

Commit 0fef093

Browse files
committed
stub: Mark Stub-based MetadataUtils methods deprecated
We don't want other APIs to copy the stub-based API to attach the interceptor. The API has a shorter name, but isn't actually all that easier to use and isn't fluent like using the interceptor API. These are _very_ old methods, so we won't be quick to delete them. Seems we should have them deprecated at least a year or two; they are easy to maintain in the mean time. See API Review notes in #1789
1 parent 57bd087 commit 0fef093

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ private MetadataUtils() {}
4343
* @param stub to bind the headers to.
4444
* @param extraHeaders the headers to be passed by each call on the returned stub.
4545
* @return an implementation of the stub with {@code extraHeaders} bound to each call.
46+
* @deprecated Replace with {@code stub.withInterceptors(newAttachHeadersInterceptor(...))}
4647
*/
4748
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
49+
@Deprecated
4850
public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) {
4951
return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders));
5052
}
@@ -98,8 +100,10 @@ public void start(Listener<RespT> responseListener, Metadata headers) {
98100
* @param trailersCapture to record the last received trailers
99101
* @return an implementation of the stub that allows to access the last received call's
100102
* headers and trailers via {@code headersCapture} and {@code trailersCapture}.
103+
* @deprecated Replace with {@code stub.withInterceptors(newCaptureMetadataInterceptor())}
101104
*/
102105
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
106+
@Deprecated
103107
public static <T extends AbstractStub<T>> T captureMetadata(
104108
T stub,
105109
AtomicReference<Metadata> headersCapture,

0 commit comments

Comments
 (0)