Copilot commented on code in PR #24790: URL: https://github.com/apache/pulsar/pull/24790#discussion_r2384260619
########## pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientSharedResourcesBuilderImpl.java: ########## @@ -0,0 +1,283 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.client.impl; + +import com.google.common.collect.Lists; +import java.net.InetSocketAddress; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import org.apache.pulsar.client.api.DnsResolverConfig; +import org.apache.pulsar.client.api.EventLoopGroupConfig; +import org.apache.pulsar.client.api.PulsarClientSharedResources; +import org.apache.pulsar.client.api.PulsarClientSharedResourcesBuilder; +import org.apache.pulsar.client.api.ThreadPoolConfig; +import org.apache.pulsar.client.api.TimerConfig; +import org.apache.pulsar.common.util.netty.DnsResolverUtil; + +public class PulsarClientSharedResourcesBuilderImpl implements PulsarClientSharedResourcesBuilder { + Set<PulsarClientSharedResources.SharedResource> sharedResources = new HashSet<>(); + Map<PulsarClientSharedResources.SharedResource, ResourceConfig> resourceConfigs = new HashMap<>(); + private boolean shareConfigured; + + interface ResourceConfig { + + } + + abstract static class NamedResourceConfig<T> implements ResourceConfig { + String name; + + public T name(String name) { + this.name = name; + return self(); + } + + @SuppressWarnings("unchecked") + T self() { + return (T) this; Review Comment: The unchecked cast could be avoided by making the class declaration more specific, such as `abstract static class NamedResourceConfig<T extends NamedResourceConfig<T>>` to enable proper self-typing. ########## build/run_unit_group.sh: ########## @@ -177,10 +177,13 @@ function test_group_other() { **/OffloadersCacheTest.java **/PrimitiveSchemaTest.java, **/BlobStoreManagedLedgerOffloaderTest.java, - **/BlobStoreManagedLedgerOffloaderStreamingTest.java' + **/BlobStoreManagedLedgerOffloaderStreamingTest.java, + **/DnsResolverTest.java' mvn_test -pl managed-ledger -Dinclude='**/ManagedLedgerTest.java, **/OffloadersCacheTest.java' + # DnsResolverTest needs to be run separately since it relies on static field values + mvn_test -pl pulsar-common -Dinclude='**/DnsResolverTest.java' Review Comment: Consider refactoring the DnsResolverTest to avoid relying on static field values so it can run with other tests instead of requiring separate execution. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
