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:57: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: *_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.  (was: {quote}
ThreadLocalRandom is a combination of 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've also had an exchange with an Oracle engineer where he indicated their disdain for JDK
{{Random}} in regards to its overall implementation.)

> 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
>
> *_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.



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

Mime
View raw message