Low friction cleanups (suggested by IntelliJ)#361
Open
samba2 wants to merge 15 commits into
Open
Conversation
added 14 commits
April 24, 2022 21:17
samba2
commented
Apr 24, 2022
| (config, now) -> _offlineRunnables.size()); | ||
| } | ||
|
|
||
| private boolean constructorContainsClass(Constructor<?>[] constructors, Class<?> classObject) { |
| try { | ||
| /* Delay 2 second to reduce the chance that produce and consumer thread has race condition | ||
| with TopicManagementService and MultiClusterTopicManagementService */ | ||
| long threadSleepMs = TimeUnit.SECONDS.toMillis(2); |
Author
There was a problem hiding this comment.
I tried to concisely use the Utils.delay(...) method. Here, I additionally had to import delay statically since a Kafka Utils class is already used. (avoiding fully qualified import)
| */ | ||
| public class Utils { | ||
| private static final Logger LOG = LoggerFactory.getLogger(Utils.class); | ||
| public static final int ZK_CONNECTION_TIMEOUT_MS = 30_000; |
| Collections.shuffle(brokerMetadataList); | ||
|
|
||
| // Get broker ids for replica list | ||
| List<Integer> replicaList = brokerMetadataList.stream().map(m -> m.id()).collect(Collectors.toList()); |
| for (Map.Entry<String, String> entry : customProps.entrySet()) { | ||
| consumerProps.put(entry.getKey(), entry.getValue()); | ||
| } | ||
| consumerProps.putAll(customProps); |
Author
There was a problem hiding this comment.
never would have spotted this myself - putAll is a convenient shortcut + also more performant (I know, not relevant here)
Comment on lines
+55
to
+56
| _metricMap = new HashMap<>(); | ||
| _dimensionsMap = new HashMap<>(); |
|
|
||
| return offsetCommitSuccessRate + offsetCommitFailureRate > 0 ? offsetCommitSuccessRate / ( | ||
| offsetCommitSuccessRate + offsetCommitFailureRate) : 0; | ||
| Measurable measurable = (config, now) -> { |
|
|
||
| Assert.assertFalse(thread.isAlive()); | ||
| Assert.assertEquals(error.get(), null); | ||
| Assert.assertNull(error.get()); |
| setup(); | ||
| Metrics metrics = consumeService.metrics(); | ||
| return metrics; | ||
| return consumeService.metrics(); |
samba2
commented
Apr 24, 2022
| public XinfraMonitorConstants() { | ||
|
|
||
| } | ||
| private XinfraMonitorConstants() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To familiarize with the code base I tried to perform a "random act of kindness" (Uncle Bob) 😊 by applying some of the suggested IntelliJ refactorings/ cleanups.