You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Linsiyuan9 (via GitHub)" <gi...@apache.org> on 2024/10/10 10:20:48 UTC
[PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Linsiyuan9 opened a new pull request, #17451:
URL: https://github.com/apache/kafka/pull/17451
*More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.*
*Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.*
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Posted by "Linsiyuan9 (via GitHub)" <gi...@apache.org>.
Linsiyuan9 commented on code in PR #17451:
URL: https://github.com/apache/kafka/pull/17451#discussion_r1797530783
##########
core/src/test/java/kafka/test/api/ShareConsumerTest.java:
##########
@@ -1635,7 +1636,7 @@ private <K, V> KafkaShareConsumer<K, V> createShareConsumer(Deserializer<K> keyD
private void warmup() throws InterruptedException, ExecutionException, TimeoutException {
createTopic(warmupTp.topic());
TestUtils.waitForCondition(() ->
- !scala.collection.JavaConverters.seqAsJavaList(cluster.brokers().get(0).metadataCache().getAliveBrokerNodes(new ListenerName("EXTERNAL"))).isEmpty(),
+ !CollectionConverters.asJava(cluster.brokers().get(0).metadataCache().getAliveBrokerNodes(new ListenerName("EXTERNAL"))).isEmpty(),
Review Comment:
hi @chia7712 , I have recommitd the code, please have a look😊
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #17451:
URL: https://github.com/apache/kafka/pull/17451
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Posted by "Linsiyuan9 (via GitHub)" <gi...@apache.org>.
Linsiyuan9 commented on PR #17451:
URL: https://github.com/apache/kafka/pull/17451#issuecomment-2410102191
There seems to be a wrong unit test, let me see
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #17451:
URL: https://github.com/apache/kafka/pull/17451#discussion_r1798468227
##########
core/src/main/java/kafka/server/builders/LogManagerBuilder.java:
##########
@@ -168,9 +168,8 @@ public LogManager build() {
if (scheduler == null) throw new RuntimeException("you must set scheduler");
if (brokerTopicStats == null) throw new RuntimeException("you must set brokerTopicStats");
if (logDirFailureChannel == null) throw new RuntimeException("you must set logDirFailureChannel");
-
- return new LogManager(JavaConverters.asScalaIteratorConverter(logDirs.iterator()).asScala().toSeq(),
- JavaConverters.asScalaIteratorConverter(initialOfflineDirs.iterator()).asScala().toSeq(),
+ return new LogManager(CollectionConverters.asScala(logDirs.iterator()).toSeq(),
Review Comment:
`CollectionConverters.asScala(logDirs).toSeq(),`
##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/SaslClientsWithInvalidCredentialsTest.java:
##########
@@ -54,15 +54,14 @@ public class SaslClientsWithInvalidCredentialsTest extends AbstractSaslTest {
public static final int NUM_PARTITIONS = 1;
public static final int BROKER_COUNT = 1;
public static final String KAFKA_CLIENT_SASL_MECHANISM = "SCRAM-SHA-256";
- private static final Seq<String> KAFKA_SERVER_SASL_MECHANISMS = JavaConverters.asScalaIteratorConverter(Collections.singletonList(KAFKA_CLIENT_SASL_MECHANISM).iterator()).asScala().toSeq();
+ private static final Seq<String> KAFKA_SERVER_SASL_MECHANISMS = CollectionConverters.asScala(Collections.singletonList(KAFKA_CLIENT_SASL_MECHANISM).iterator()).toSeq();
Review Comment:
`CollectionConverters.asScala(Collections.singletonList(KAFKA_CLIENT_SASL_MECHANISM));`
##########
tools/src/test/java/org/apache/kafka/tools/other/ReplicationQuotasTestRig.java:
##########
@@ -477,8 +477,7 @@ String path() {
}
}
- @SuppressWarnings({"deprecation"})
private static <T> Seq<T> seq(Collection<T> seq) {
- return JavaConverters.asScalaIteratorConverter(seq.iterator()).asScala().toSeq();
+ return CollectionConverters.asScala(seq.iterator()).toSeq();
Review Comment:
`CollectionConverters.asScala(seq).toSeq();`
##########
core/src/main/java/kafka/server/builders/LogManagerBuilder.java:
##########
@@ -168,9 +168,8 @@ public LogManager build() {
if (scheduler == null) throw new RuntimeException("you must set scheduler");
if (brokerTopicStats == null) throw new RuntimeException("you must set brokerTopicStats");
if (logDirFailureChannel == null) throw new RuntimeException("you must set logDirFailureChannel");
-
- return new LogManager(JavaConverters.asScalaIteratorConverter(logDirs.iterator()).asScala().toSeq(),
- JavaConverters.asScalaIteratorConverter(initialOfflineDirs.iterator()).asScala().toSeq(),
+ return new LogManager(CollectionConverters.asScala(logDirs.iterator()).toSeq(),
+ CollectionConverters.asScala(initialOfflineDirs.iterator()).toSeq(),
Review Comment:
`CollectionConverters.asScala(initialOfflineDirs).toSeq()`
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #17451:
URL: https://github.com/apache/kafka/pull/17451#discussion_r1797521277
##########
core/src/test/java/kafka/test/api/ShareConsumerTest.java:
##########
@@ -1635,7 +1636,7 @@ private <K, V> KafkaShareConsumer<K, V> createShareConsumer(Deserializer<K> keyD
private void warmup() throws InterruptedException, ExecutionException, TimeoutException {
createTopic(warmupTp.topic());
TestUtils.waitForCondition(() ->
- !scala.collection.JavaConverters.seqAsJavaList(cluster.brokers().get(0).metadataCache().getAliveBrokerNodes(new ListenerName("EXTERNAL"))).isEmpty(),
+ !CollectionConverters.asJava(cluster.brokers().get(0).metadataCache().getAliveBrokerNodes(new ListenerName("EXTERNAL"))).isEmpty(),
Review Comment:
We can use `isEmpty` directly even though it is scala code, right?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17746 Replace JavaConverters with CollectionConverters [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #17451:
URL: https://github.com/apache/kafka/pull/17451#issuecomment-2410250734
the failed test is traced by #17366
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org