Skip to content

Commit

Permalink
stub: remove 2 deprecated methods from MetadataUtils (grpc#10443)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaypujare authored and larry-safran committed Aug 2, 2023
1 parent edefee4 commit 187f986
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions stub/src/main/java/io/grpc/stub/MetadataUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.errorprone.annotations.InlineMe;
import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
import io.grpc.ExperimentalApi;
import io.grpc.ForwardingClientCall.SimpleForwardingClientCall;
import io.grpc.ForwardingClientCallListener.SimpleForwardingClientCallListener;
import io.grpc.Metadata;
Expand All @@ -38,24 +36,6 @@ public final class MetadataUtils {
// Prevent instantiation
private MetadataUtils() {}

/**
* Attaches a set of request headers to a stub.
*
* @param stub to bind the headers to.
* @param extraHeaders the headers to be passed by each call on the returned stub.
* @return an implementation of the stub with {@code extraHeaders} bound to each call.
* @deprecated Use {@code stub.withInterceptors(newAttachHeadersInterceptor(...))} instead.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
@Deprecated
@InlineMe(
replacement =
"stub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(extraHeaders))",
imports = "io.grpc.stub.MetadataUtils")
public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) {
return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders));
}

/**
* Returns a client interceptor that attaches a set of headers to requests.
*
Expand Down Expand Up @@ -97,31 +77,6 @@ public void start(Listener<RespT> responseListener, Metadata headers) {
}
}

/**
* Captures the last received metadata for a stub. Useful for testing
*
* @param stub to capture for
* @param headersCapture to record the last received headers
* @param trailersCapture to record the last received trailers
* @return an implementation of the stub that allows to access the last received call's
* headers and trailers via {@code headersCapture} and {@code trailersCapture}.
* @deprecated Use {@code stub.withInterceptors(newCaptureMetadataInterceptor())} instead.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
@Deprecated
@InlineMe(
replacement =
"stub.withInterceptors(MetadataUtils.newCaptureMetadataInterceptor(headersCapture,"
+ " trailersCapture))",
imports = "io.grpc.stub.MetadataUtils")
public static <T extends AbstractStub<T>> T captureMetadata(
T stub,
AtomicReference<Metadata> headersCapture,
AtomicReference<Metadata> trailersCapture) {
return stub.withInterceptors(
newCaptureMetadataInterceptor(headersCapture, trailersCapture));
}

/**
* Captures the last received metadata on a channel. Useful for testing.
*
Expand Down

0 comments on commit 187f986

Please sign in to comment.