Bug 57145 - RandomController : Use ThreadLocalRandom instead of Random for better performances
Summary: RandomController : Use ThreadLocalRandom instead of Random for better perform...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.11
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-26 14:01 UTC by Philippe Mouawad
Modified: 2014-11-26 21:18 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2014-10-26 14:01:48 UTC
As per javadoc:
http://docs.oracle.com/javase/7/docs/api/java/util/Random.html

"Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded designs."

As we need to support Java6, I will be using Doug Lea class which is under Commons Creative License 1.0 and compatible with Apache license:

    http://www.apache.org/legal/resolved.html#category-b


Can Works Placed In The Public Domain Be Included In Apache Products?

Works in the public domain (or covered by a license treated similarly) may be included within Apache products. Attribution is required (in a similar fashion to permissive licenses).

A work should be treated as being in the public domain when one of the following applies:

    the work is covered by
        the Creative Commons Public Domain Mark, or
        a suitable dedication (to the public domain) by the authors; or => WE ARE IN THIS CASE.
    clear evidence exists that US copyright for the work
        has expired, or
        cannot be claimed.
Comment 1 Philippe Mouawad 2014-11-26 21:18:12 UTC
Date: Sun Oct 26 14:26:10 2014
New Revision: 1634335

URL: http://svn.apache.org/r1634335
Log:
Bug 57145 - RandomController : Use ThreadLocalRandom instead of Random for better performances
Bugzilla Id: 57145

Added:
    jmeter/trunk/licenses/bin/ThreadLocalRandom.txt   (with props)
    jmeter/trunk/src/core/org/apache/jmeter/util/ThreadLocalRandom.java   (with props)
Modified:
    jmeter/trunk/src/components/org/apache/jmeter/control/RandomController.java
    jmeter/trunk/xdocs/changes.xml