Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stub: remove 2 deprecated methods from MetadataUtils #10443

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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