Skip to content

Commit

Permalink
s2a: remove channelPool from S2AChannelCredentials builder. (grpc#11573)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 authored Sep 30, 2024
1 parent a140e1b commit 7b4b109
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
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;

Expand Down Expand Up @@ -59,13 +58,11 @@ public static Builder newBuilder(String s2aAddress, ChannelCredentials s2aChanne
public static final class Builder {
private final String s2aAddress;
private final ChannelCredentials s2aChannelCredentials;
private ObjectPool<Channel> s2aChannelPool;
private @Nullable S2AIdentity localIdentity = null;

Builder(String s2aAddress, ChannelCredentials s2aChannelCredentials) {
this.s2aAddress = s2aAddress;
this.s2aChannelCredentials = s2aChannelCredentials;
this.s2aChannelPool = null;
}

/**
Expand Down Expand Up @@ -107,16 +104,15 @@ public Builder setLocalUid(String localUid) {
return this;
}

public ChannelCredentials build() throws IOException {
ObjectPool<Channel> s2aChannelPool =
SharedResourcePool.forResource(
S2AHandshakerServiceChannel.getChannelResource(s2aAddress, s2aChannelCredentials));
checkNotNull(s2aChannelPool, "s2aChannelPool");
this.s2aChannelPool = s2aChannelPool;
public ChannelCredentials build() {
return InternalNettyChannelCredentials.create(buildProtocolNegotiatorFactory());
}

InternalProtocolNegotiator.ClientFactory buildProtocolNegotiatorFactory() {
ObjectPool<Channel> s2aChannelPool =
SharedResourcePool.forResource(
S2AHandshakerServiceChannel.getChannelResource(s2aAddress, s2aChannelCredentials));
checkNotNull(s2aChannelPool, "s2aChannelPool");
return S2AProtocolNegotiatorFactory.createClientFactory(localIdentity, s2aChannelPool);
}
}
Expand Down

0 comments on commit 7b4b109

Please sign in to comment.