hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiroshi Ikeda (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-15702) Improve PerClientRandomNonceGenerator
Date Thu, 28 Apr 2016 09:16:12 GMT

    [ https://issues.apache.org/jira/browse/HBASE-15702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261822#comment-15261822
] 

Hiroshi Ikeda commented on HBASE-15702:
---------------------------------------

Yes. When threads try to load the same class, the loading is exclusively done with locking
the class object. That is described in the JLS.
That synchronization procedure is a little cheat and is a little different from the one Java
programers use.


> Improve PerClientRandomNonceGenerator
> -------------------------------------
>
>                 Key: HBASE-15702
>                 URL: https://issues.apache.org/jira/browse/HBASE-15702
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Hiroshi Ikeda
>            Priority: Trivial
>             Fix For: 2.0.0
>
>         Attachments: HBASE-15702.patch, HBASE-15702_v1.patch, HBASE-15702_v2.patch
>
>
> PerClientRandomNonceGenerator can be exposed to all the threads via the static field
ConnectionManager.nonceGenerator, but PerClientRandomNonceGenerator uses Random, which should
be ThreadLocalRandom or something. (See javadoc of Random.)
> Moreover, ConnectionManager creates or refers the singleton instance of PerClientThreadLocalRandom
with a lock or volatile, but it should be created as a static final field in PerClientThreadLocalRandom
itself, and the creation will be postponed until the field is actually refereed and the class
is being initialized.
> The same can be said for ConnectionManager.NoNonceGenerator.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message