mirror of https://github.com/grpc/grpc-java.git
core: Loop over interceptors when computing effective interceptors
A post-merge review of 8516cfef9
suggested this change and the comment
had been lost in my inbox.
This commit is contained in:
parent
54d37839a3
commit
2db4852e23
|
@ -737,18 +737,16 @@ public final class ManagedChannelImplBuilder
|
|||
// TODO(zdapeng): FIX IT
|
||||
@VisibleForTesting
|
||||
List<ClientInterceptor> getEffectiveInterceptors(String computedTarget) {
|
||||
List<ClientInterceptor> effectiveInterceptors = new ArrayList<>(this.interceptors);
|
||||
for (int i = 0; i < effectiveInterceptors.size(); i++) {
|
||||
if (!(effectiveInterceptors.get(i) instanceof InterceptorFactoryWrapper)) {
|
||||
continue;
|
||||
List<ClientInterceptor> effectiveInterceptors = new ArrayList<>(this.interceptors.size());
|
||||
for (ClientInterceptor interceptor : this.interceptors) {
|
||||
if (interceptor instanceof InterceptorFactoryWrapper) {
|
||||
InterceptorFactory factory = ((InterceptorFactoryWrapper) interceptor).factory;
|
||||
interceptor = factory.newInterceptor(computedTarget);
|
||||
if (interceptor == null) {
|
||||
throw new NullPointerException("Factory returned null interceptor: " + factory);
|
||||
}
|
||||
}
|
||||
InterceptorFactory factory =
|
||||
((InterceptorFactoryWrapper) effectiveInterceptors.get(i)).factory;
|
||||
ClientInterceptor interceptor = factory.newInterceptor(computedTarget);
|
||||
if (interceptor == null) {
|
||||
throw new NullPointerException("Factory returned null interceptor: " + factory);
|
||||
}
|
||||
effectiveInterceptors.set(i, interceptor);
|
||||
effectiveInterceptors.add(interceptor);
|
||||
}
|
||||
|
||||
boolean disableImplicitCensus = InternalConfiguratorRegistry.wasSetConfiguratorsCalled();
|
||||
|
|
Loading…
Reference in New Issue