You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "kwonyonghyun (via GitHub)" <gi...@apache.org> on 2024/10/11 05:43:13 UTC

[PR] Refactor: Improve code consistency and readability [kafka]

kwonyonghyun opened a new pull request, #17464:
URL: https://github.com/apache/kafka/pull/17464

   Description:
   This PR introduces two improvements to enhance code consistency and readability:
   
   1. Extract duplicate exception message into a private constant
      - The message "Acquisition lock never got released." is now a private static final String constant ACQUISITION_LOCK_NEVER_GOT_RELEASED
      - Reduces duplication and improves maintainability
      - Makes it easier to update this message in the future if needed
      - Encapsulates the constant within the class, adhering to best practices for information hiding
   
   2. Replace hardcoded "member-1" strings with existing MEMBER_ID constant
      - Enhances code consistency across the codebase
      - Makes future updates easier by centralizing the member ID value
      - Reduces the risk of typos or inconsistencies when referring to member IDs
   
   Please review these changes and provide any feedback or concerns. 


-- 
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] Refactor: Improve code consistency and readability [kafka]

Posted by "kwonyonghyun (via GitHub)" <gi...@apache.org>.
kwonyonghyun commented on PR #17464:
URL: https://github.com/apache/kafka/pull/17464#issuecomment-2406762337

   Thank you for the review @m1a2st ! I fixed the problems you mentioned


-- 
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] Refactor: Improve code consistency and readability [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #17464:
URL: https://github.com/apache/kafka/pull/17464#discussion_r1796525709


##########
core/src/test/java/kafka/server/share/SharePartitionTest.java:
##########
@@ -87,10 +87,11 @@
 
 public class SharePartitionTest {
 
+    public static final String ACQUISITION_LOCK_NEVER_GOT_RELEASED = "Acquisition lock never got released.";

Review Comment:
   If this property only use it this file, it should be `private`



##########
core/src/test/java/kafka/server/share/SharePartitionTest.java:
##########
@@ -87,10 +87,11 @@
 
 public class SharePartitionTest {
 
+    public static final String ACQUISITION_LOCK_NEVER_GOT_RELEASED = "Acquisition lock never got released.";
     private static final String GROUP_ID = "test-group";
-    private static final String MEMBER_ID = "member-1";
     private static final int MAX_DELIVERY_COUNT = 5;
     private static final TopicIdPartition TOPIC_ID_PARTITION = new TopicIdPartition(Uuid.randomUuid(), 0, "test-topic");
+    public static final String MEMBER_ID = "member-1";

Review Comment:
   Why we need to change this property from `private` to `public` ?



-- 
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] Refactor: Improve code consistency and readability [kafka]

Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison merged PR #17464:
URL: https://github.com/apache/kafka/pull/17464


-- 
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