From 7b4b10930993df70916c6983c56c70a0e71a266f Mon Sep 17 00:00:00 2001 From: Riya Mehta <55350838+rmehta19@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:55:42 -0700 Subject: [PATCH] s2a: remove channelPool from S2AChannelCredentials builder. (#11573) --- .../java/io/grpc/s2a/S2AChannelCredentials.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java b/s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java index 12963a1395..7beecdb362 100644 --- a/s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java +++ b/s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java @@ -31,7 +31,6 @@ import io.grpc.netty.InternalProtocolNegotiator; import io.grpc.s2a.channel.S2AHandshakerServiceChannel; import io.grpc.s2a.handshaker.S2AIdentity; import io.grpc.s2a.handshaker.S2AProtocolNegotiatorFactory; -import java.io.IOException; import javax.annotation.concurrent.NotThreadSafe; import org.checkerframework.checker.nullness.qual.Nullable; @@ -59,13 +58,11 @@ public final class S2AChannelCredentials { public static final class Builder { private final String s2aAddress; private final ChannelCredentials s2aChannelCredentials; - private ObjectPool s2aChannelPool; private @Nullable S2AIdentity localIdentity = null; Builder(String s2aAddress, ChannelCredentials s2aChannelCredentials) { this.s2aAddress = s2aAddress; this.s2aChannelCredentials = s2aChannelCredentials; - this.s2aChannelPool = null; } /** @@ -107,16 +104,15 @@ public final class S2AChannelCredentials { return this; } - public ChannelCredentials build() throws IOException { - ObjectPool s2aChannelPool = - SharedResourcePool.forResource( - S2AHandshakerServiceChannel.getChannelResource(s2aAddress, s2aChannelCredentials)); - checkNotNull(s2aChannelPool, "s2aChannelPool"); - this.s2aChannelPool = s2aChannelPool; + public ChannelCredentials build() { return InternalNettyChannelCredentials.create(buildProtocolNegotiatorFactory()); } InternalProtocolNegotiator.ClientFactory buildProtocolNegotiatorFactory() { + ObjectPool s2aChannelPool = + SharedResourcePool.forResource( + S2AHandshakerServiceChannel.getChannelResource(s2aAddress, s2aChannelCredentials)); + checkNotNull(s2aChannelPool, "s2aChannelPool"); return S2AProtocolNegotiatorFactory.createClientFactory(localIdentity, s2aChannelPool); } }