Skip to content

Set the appropriate parameters when calling the Logger method#4377

Closed
hapihu wants to merge 1 commit intoapache:masterfrom
hapihu:master
Closed

Set the appropriate parameters when calling the Logger method#4377
hapihu wants to merge 1 commit intoapache:masterfrom
hapihu:master

Conversation

@hapihu
Copy link
Contributor

@hapihu hapihu commented May 26, 2019

Not enough arguments for Logger's method.
Set the appropriate parameters when calling the Logger method.

position = null;
log.debug(">>> Lock {} released token={} at {}", this.hashCode(),
Thread.currentThread().getStackTrace()[2]);
position = Thread.currentThread().getStackTrace()[2].toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Thread.currentThread().getStackTrace()[2] return null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  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.

@sijie sijie added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label May 27, 2019
@hapihu
Copy link
Contributor Author

hapihu commented May 30, 2019

Let me verify it a little bit more;
Before I do that, let me close this pull request.

@hapihu hapihu closed this May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants