zookeeper-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Mollitor (Jira)" <j...@apache.org>
Subject [jira] [Updated] (ZOOKEEPER-3671) Use ThreadLocalConcurrent to Replace Random and Math.random
Date Thu, 02 Jan 2020 17:58:00 GMT

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

David Mollitor updated ZOOKEEPER-3671:
--------------------------------------
    Description: 
{quote}
*_ThreadLocalRandom_ is a combination of _[ThreadLocal|https://www.baeldung.com/java-threadlocal]_ and _Random_ classes,
which is isolated to the current thread.* Thus, it achieves better performance in a multithreaded
environment by simply avoiding any concurrent access to the _Random_ objects.
{quote}

https://www.baeldung.com/java-thread-local-random

I also had a conversation with a Oracle Java engineer that indicated that {{ThreadLocalRandom}}
is preferable with new development.

  was:*_ThreadLocalRandom_ is a combination of _[ThreadLocal|https://www.baeldung.com/java-threadlocal]_ and _Random_ classes,
which is isolated to the current thread.* Thus, it achieves better performance in a multithreaded
environment by simply avoiding any concurrent access to the _Random_ objects.


> Use ThreadLocalConcurrent to Replace Random and Math.random
> -----------------------------------------------------------
>
>                 Key: ZOOKEEPER-3671
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3671
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {quote}
> *_ThreadLocalRandom_ is a combination of _[ThreadLocal|https://www.baeldung.com/java-threadlocal]_ and _Random_ classes,
which is isolated to the current thread.* Thus, it achieves better performance in a multithreaded
environment by simply avoiding any concurrent access to the _Random_ objects.
> {quote}
> https://www.baeldung.com/java-thread-local-random
> I also had a conversation with a Oracle Java engineer that indicated that {{ThreadLocalRandom}}
is preferable with new development.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message