Browse Source

MINOR: Used Admin instead of AdminClient to create Admin (#14411)

Used Admin instead of AdminClient to create Admin

Reviewers: Ziming Deng <dengziming1993@gmail.com>
pull/14420/head
Wuzhengyu97 1 year ago committed by GitHub
parent
commit
fcd382138e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java
  2. 10
      streams/src/test/java/org/apache/kafka/streams/integration/KStreamRepartitionIntegrationTest.java
  3. 8
      streams/src/test/java/org/apache/kafka/streams/integration/StreamTableJoinTopologyOptimizationIntegrationTest.java

3
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.apache.kafka.server.log.remote.metadata.storage;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.clients.producer.RecordMetadata;
@ -378,7 +377,7 @@ public class TopicBasedRemoteLogMetadataManager implements RemoteLogMetadataMana @@ -378,7 +377,7 @@ public class TopicBasedRemoteLogMetadataManager implements RemoteLogMetadataMana
long startTimeMs = time.milliseconds();
Admin adminClient = null;
try {
adminClient = AdminClient.create(rlmmConfig.commonProperties());
adminClient = Admin.create(rlmmConfig.commonProperties());
// Stop if it is already initialized or closing.
while (!(initialized.get() || closing.get())) {

10
streams/src/test/java/org/apache/kafka/streams/integration/KStreamRepartitionIntegrationTest.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
*/
package org.apache.kafka.streams.integration;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.clients.consumer.ConsumerConfig;
@ -757,7 +757,7 @@ public class KStreamRepartitionIntegrationTest { @@ -757,7 +757,7 @@ public class KStreamRepartitionIntegrationTest {
}
private int getNumberOfPartitionsForTopic(final String topic) throws Exception {
try (final AdminClient adminClient = createAdminClient()) {
try (final Admin adminClient = createAdminClient()) {
final TopicDescription topicDescription = adminClient.describeTopics(Collections.singleton(topic))
.topicNameValues()
.get(topic)
@ -768,7 +768,7 @@ public class KStreamRepartitionIntegrationTest { @@ -768,7 +768,7 @@ public class KStreamRepartitionIntegrationTest {
}
private boolean topicExists(final String topic) throws Exception {
try (final AdminClient adminClient = createAdminClient()) {
try (final Admin adminClient = createAdminClient()) {
final Set<String> topics = adminClient.listTopics()
.names()
.get();
@ -781,11 +781,11 @@ public class KStreamRepartitionIntegrationTest { @@ -781,11 +781,11 @@ public class KStreamRepartitionIntegrationTest {
return applicationId + "-" + input + "-repartition";
}
private static AdminClient createAdminClient() {
private static Admin createAdminClient() {
final Properties properties = new Properties();
properties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
return AdminClient.create(properties);
return Admin.create(properties);
}
private static int countOccurrencesInTopology(final String topologyString,

8
streams/src/test/java/org/apache/kafka/streams/integration/StreamTableJoinTopologyOptimizationIntegrationTest.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
*/
package org.apache.kafka.streams.integration;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.clients.consumer.ConsumerConfig;
@ -206,7 +206,7 @@ public class StreamTableJoinTopologyOptimizationIntegrationTest { @@ -206,7 +206,7 @@ public class StreamTableJoinTopologyOptimizationIntegrationTest {
}
private int getNumberOfPartitionsForTopic(final String topic) throws Exception {
try (final AdminClient adminClient = createAdminClient()) {
try (final Admin adminClient = createAdminClient()) {
final TopicDescription topicDescription = adminClient.describeTopics(Collections.singleton(topic))
.topicNameValues()
.get(topic)
@ -262,10 +262,10 @@ public class StreamTableJoinTopologyOptimizationIntegrationTest { @@ -262,10 +262,10 @@ public class StreamTableJoinTopologyOptimizationIntegrationTest {
);
}
private static AdminClient createAdminClient() {
private static Admin createAdminClient() {
final Properties properties = new Properties();
properties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
return AdminClient.create(properties);
return Admin.create(properties);
}
}

Loading…
Cancel
Save