You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Cameron McKenzie (JIRA)" <ji...@apache.org> on 2019/03/31 22:08:00 UTC
[jira] [Commented] (CURATOR-514) Utilize ThreadLocalRandom In
QueueSharder
[ https://issues.apache.org/jira/browse/CURATOR-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16806277#comment-16806277 ]
Cameron McKenzie commented on CURATOR-514:
------------------------------------------
The fix looks fine to me. I'm just wondering what the normal use case for the QueueSharder is? I would have expected that each client of the queue would tend to be in a separate JVM, in which case the Random doesn't have the contention issues. I guess there's no harm in the change though.
> Utilize ThreadLocalRandom In QueueSharder
> -----------------------------------------
>
> Key: CURATOR-514
> URL: https://issues.apache.org/jira/browse/CURATOR-514
> Project: Apache Curator
> Issue Type: Improvement
> Components: Recipes
> Affects Versions: 4.2.0
> Reporter: David Mollitor
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> bq. When applicable, use of ThreadLocalRandom rather than shared Random objects in concurrent programs will typically encounter much less overhead and contention.
> https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadLocalRandom.html
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)