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 2019/05/27 14:07:23 UTC

[GitHub] [pulsar] hapihu commented on a change in pull request #4377: Set the appropriate parameters when calling the Logger method

hapihu commented on a change in pull request #4377: Set the appropriate parameters when calling the Logger method
URL: https://github.com/apache/pulsar/pull/4377#discussion_r287804264
 
 

 ##########
 File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/CallbackMutex.java
 ##########
 @@ -61,9 +61,8 @@ public boolean tryLock() {
     public void unlock() {
         if (log.isDebugEnabled()) {
             owner = null;
-            position = null;
-            log.debug(">>> Lock {} released token={} at {}", this.hashCode(),
-                    Thread.currentThread().getStackTrace()[2]);
+            position = Thread.currentThread().getStackTrace()[2].toString();
 
 Review comment:
   
   1. This method Thread.currentThread().getStackTrace() will not return null.
   
   2. StackTraceElement[] array = Thread.currentThread().getStackTrace();
   	
   	Usually, the length of array is greater than or equal to 2 when the thread is running.
   
   	I did a test.
   
   	The length is 2,when this method was called in Main(),otherwise the length is greater than 2.
   
   3. Also, I ran the test case(unlock) in org.apache.bookkeeper.mledger.util.CallbackMutexTest.java.
   	The test results were normal.
   	
   4. So, I think calling here, Thread.currentThread().getStackTrace()[2]  will not return null.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services