chia7712 commented on code in PR #15808: URL: https://github.com/apache/kafka/pull/15808#discussion_r1584095279
########## core/src/test/scala/unit/kafka/log/remote/RemoteIndexCacheTest.scala: ########## @@ -1086,4 +1087,10 @@ class RemoteIndexCacheTest { case e @ (_ : NoSuchFileException | _ : UncheckedIOException) => Optional.empty() } } + + private def numThreadsRunning(threadNamePrefix: String, isDaemon: Boolean): mutable.Set[Thread] = { Review Comment: We can fix the build error by rewriting this function via java lambda. For example: ```scala private def numThreadsRunning(threadNamePrefix: String, isDaemon: Boolean): java.util.Set[Thread] = { Thread.getAllStackTraces.keySet.stream().filter { t => isDaemon && t.isAlive && t.getName.startsWith(threadNamePrefix) }.collect(Collectors.toSet) } ``` ########## core/src/test/scala/unit/kafka/log/remote/RemoteIndexCacheTest.scala: ########## @@ -23,25 +23,26 @@ import org.apache.kafka.common.{TopicIdPartition, TopicPartition, Uuid} import org.apache.kafka.server.log.remote.storage.RemoteStorageManager.IndexType import org.apache.kafka.server.log.remote.storage.{RemoteLogSegmentId, RemoteLogSegmentMetadata, RemoteResourceNotFoundException, RemoteStorageManager} import org.apache.kafka.server.util.MockTime -import org.apache.kafka.storage.internals.log.RemoteIndexCache.{DIR_NAME, Entry, REMOTE_LOG_INDEX_CACHE_CLEANER_THREAD, remoteDeletedSuffixIndexFileName, remoteOffsetIndexFile, remoteOffsetIndexFileName, remoteTimeIndexFile, remoteTimeIndexFileName, remoteTransactionIndexFile, remoteTransactionIndexFileName} -import org.apache.kafka.storage.internals.log.{AbortedTxn, CorruptIndexException, LogFileUtils, OffsetIndex, OffsetPosition, RemoteIndexCache, TimeIndex, TransactionIndex} +import org.apache.kafka.storage.internals.log.RemoteIndexCache._ +import org.apache.kafka.storage.internals.log._ import org.apache.kafka.test.{TestUtils => JTestUtils} import org.junit.jupiter.api.Assertions._ import org.junit.jupiter.api.{AfterEach, BeforeEach, Test} import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers.any -import org.mockito.invocation.InvocationOnMock import org.mockito.Mockito._ +import org.mockito.invocation.InvocationOnMock import org.slf4j.{Logger, LoggerFactory} -import java.io.{File, FileInputStream, IOException, PrintWriter, UncheckedIOException} +import java.io._ Review Comment: We should avoid using `_` since it could cause naming conflicts. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org