You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/30 06:46:47 UTC

[GitHub] [pulsar] mattisonchao opened a new pull request #11165: [ Cleanup ] Cleanup some code

mattisonchao opened a new pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165


   ### Motivation
   
   Cleanup some code
   
   ### Modifications
   
   - Fixed incorrect use logger.
   - Use Awaitility to instead of Thread sleep
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on a change in pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#discussion_r663055468



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/EventLoopUtil.java
##########
@@ -65,8 +65,7 @@ public static EventLoopGroup newEventLoopGroup(int nThreads, boolean enableBusyW
                     try {
                         CpuAffinity.acquireCore();
                     } catch (Throwable t) {
-                        log.warn("Failed to acquire CPU core for thread {}", Thread.currentThread().getName(),
-                                t.getMessage(), t);
+                        log.warn("Failed to acquire CPU core for thread {}",Thread.currentThread().getName(), t);

Review comment:
       I will fix it.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#issuecomment-873041790


   @eolivelli  PTAL


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#issuecomment-872796246


   @eolivelli PTAL 👍🏼 


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on a change in pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#discussion_r662812744



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/EventLoopUtil.java
##########
@@ -65,8 +65,8 @@ public static EventLoopGroup newEventLoopGroup(int nThreads, boolean enableBusyW
                     try {
                         CpuAffinity.acquireCore();
                     } catch (Throwable t) {
-                        log.warn("Failed to acquire CPU core for thread {}", Thread.currentThread().getName(),
-                                t.getMessage(), t);
+                        log.warn("Failed to acquire CPU core for thread {}, the error message is {}",

Review comment:
       I already fix it. :) 

##########
File path: pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/GrowableArrayBlockingQueueTest.java
##########
@@ -131,11 +132,8 @@ public void blockingTake() throws Exception {
                 queue.put(n);
                 ++n;
             }
-
             // Wait until all the entries are consumed
-            while (!queue.isEmpty()) {
-                Thread.sleep(1);
-            }
+            Awaitility.await().until(queue::isEmpty);

Review comment:
       I already fix it.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on pull request #11165: [ Cleanup ] Cleanup some code

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#issuecomment-871196970


   /pulsarbot rerun-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#issuecomment-873809945


   /pulsarbot rerun-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao closed pull request #11165: [ Cleanup ] cleaning up the code

Posted by GitBox <gi...@apache.org>.
mattisonchao closed pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli commented on a change in pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#discussion_r663006595



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/EventLoopUtil.java
##########
@@ -65,8 +65,7 @@ public static EventLoopGroup newEventLoopGroup(int nThreads, boolean enableBusyW
                     try {
                         CpuAffinity.acquireCore();
                     } catch (Throwable t) {
-                        log.warn("Failed to acquire CPU core for thread {}", Thread.currentThread().getName(),
-                                t.getMessage(), t);
+                        log.warn("Failed to acquire CPU core for thread {}",Thread.currentThread().getName(), t);

Review comment:
       Missing one space in ",Thread":
   `log.warn("Failed to acquire CPU core for thread {}", Thread.currentThread().getName(), t);`




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli commented on a change in pull request #11165: [ Cleanup ] Use Awaitility to instead of Thread sleep

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11165:
URL: https://github.com/apache/pulsar/pull/11165#discussion_r662805507



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/EventLoopUtil.java
##########
@@ -65,8 +65,8 @@ public static EventLoopGroup newEventLoopGroup(int nThreads, boolean enableBusyW
                     try {
                         CpuAffinity.acquireCore();
                     } catch (Throwable t) {
-                        log.warn("Failed to acquire CPU core for thread {}", Thread.currentThread().getName(),
-                                t.getMessage(), t);
+                        log.warn("Failed to acquire CPU core for thread {}, the error message is {}",

Review comment:
       log.warn will print the stacktrace when you pass a Throwable argument, so no need for "the error message is {}"

##########
File path: pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/GrowableArrayBlockingQueueTest.java
##########
@@ -131,11 +132,8 @@ public void blockingTake() throws Exception {
                 queue.put(n);
                 ++n;
             }
-
             // Wait until all the entries are consumed
-            while (!queue.isEmpty()) {
-                Thread.sleep(1);
-            }
+            Awaitility.await().until(queue::isEmpty);

Review comment:
       Awaitility will not pool every millisecond by default
   this change will slow down the test and probably is is overwhelming
   this is a test about a BlockingQueue, it is fine to have a Thread.sleep here
   it is not a cause of flaky tests




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org