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
|
// TODO(zdapeng): FIX IT
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
List<ClientInterceptor> getEffectiveInterceptors(String computedTarget) {
|
List<ClientInterceptor> getEffectiveInterceptors(String computedTarget) {
|
||||||
List<ClientInterceptor> effectiveInterceptors = new ArrayList<>(this.interceptors);
|
List<ClientInterceptor> effectiveInterceptors = new ArrayList<>(this.interceptors.size());
|
||||||
for (int i = 0; i < effectiveInterceptors.size(); i++) {
|
for (ClientInterceptor interceptor : this.interceptors) {
|
||||||
if (!(effectiveInterceptors.get(i) instanceof InterceptorFactoryWrapper)) {
|
if (interceptor instanceof InterceptorFactoryWrapper) {
|
||||||
continue;
|
InterceptorFactory factory = ((InterceptorFactoryWrapper) interceptor).factory;
|
||||||
|
interceptor = factory.newInterceptor(computedTarget);
|
||||||
|
if (interceptor == null) {
|
||||||
|
throw new NullPointerException("Factory returned null interceptor: " + factory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
InterceptorFactory factory =
|
effectiveInterceptors.add(interceptor);
|
||||||
((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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean disableImplicitCensus = InternalConfiguratorRegistry.wasSetConfiguratorsCalled();
|
boolean disableImplicitCensus = InternalConfiguratorRegistry.wasSetConfiguratorsCalled();
|
||||||
|
|
Loading…
Reference in New Issue