Don't reuse metadata in ServerInterceptorUtil

This commit is contained in:
Ravi Khadiwala
2026-02-24 13:24:41 -06:00
committed by ravi-signal
parent eedc4e23fe
commit 77c4962db8

View File

@@ -15,8 +15,6 @@ public class ServerInterceptorUtil {
@SuppressWarnings("rawtypes")
private static final ServerCall.Listener NO_OP_LISTENER = new ServerCall.Listener<>() {};
private static final Metadata EMPTY_TRAILERS = new Metadata();
private ServerInterceptorUtil() {
}
@@ -32,7 +30,7 @@ public class ServerInterceptorUtil {
* @param <RespT> the type of response object returned by the server call
*/
public static <ReqT, RespT> ServerCall.Listener<ReqT> closeWithStatus(final ServerCall<ReqT, RespT> call, final Status status) {
call.close(status, EMPTY_TRAILERS);
call.close(status, new Metadata());
//noinspection unchecked
return NO_OP_LISTENER;