Reduce lock scope in StringHelper#randomId()#15631
Reduce lock scope in StringHelper#randomId()#15631easyice wants to merge 3 commits intoapache:mainfrom
Conversation
|
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution! |
|
@easyice -- I don't know the Java lock semantics well enough to know which is more expensive, acquiring a mutex or using an I was able to get rid of the lock altogether (replacing it with optimistic locking from I honestly don't know if that's any better though. As you said in the description, the impact may be minimal anyway. |
|
@msfroh This makes sense to me. My understanding is that Could you open a new PR for this, or push the change here? |
This change moves
BigInteger#toByteArray()outside thesynchronizedblock, since it allocates and copies data. this method does not seem to be on a hot path, so the performance impact may be minimal.