Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0D254200B4C for ; Thu, 7 Jul 2016 15:46:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0BDA6160A68; Thu, 7 Jul 2016 13:46:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5B913160A72 for ; Thu, 7 Jul 2016 15:46:35 +0200 (CEST) Received: (qmail 84356 invoked by uid 500); 7 Jul 2016 13:46:34 -0000 Mailing-List: contact commits-help@beam.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.incubator.apache.org Delivered-To: mailing list commits@beam.incubator.apache.org Received: (qmail 84336 invoked by uid 99); 7 Jul 2016 13:46:34 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2016 13:46:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 11D5E1A12E2 for ; Thu, 7 Jul 2016 13:46:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id gutlzBSqSdwY for ; Thu, 7 Jul 2016 13:46:32 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with SMTP id 079725F237 for ; Thu, 7 Jul 2016 13:46:31 +0000 (UTC) Received: (qmail 84197 invoked by uid 99); 7 Jul 2016 13:46:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2016 13:46:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CE3EDE05D9; Thu, 7 Jul 2016 13:46:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lcwik@apache.org To: commits@beam.incubator.apache.org Date: Thu, 07 Jul 2016 13:46:31 -0000 Message-Id: <51fb0593f37a476891b8c9560c3cfaf4@git.apache.org> In-Reply-To: <9fe86a5b2e554371aed47c094639766b@git.apache.org> References: <9fe86a5b2e554371aed47c094639766b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/4] incubator-beam git commit: Uses ThreadLocalRandom.current to generate a random hashCode archived-at: Thu, 07 Jul 2016 13:46:36 -0000 Uses ThreadLocalRandom.current to generate a random hashCode Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/9df033cb Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/9df033cb Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/9df033cb Branch: refs/heads/master Commit: 9df033cb0921836b25ff685c55fc1a93fff4a36f Parents: 708244b Author: Lucas Amorim Authored: Wed Jul 6 23:01:55 2016 -0700 Committer: Luke Cwik Committed: Thu Jul 7 09:07:15 2016 -0400 ---------------------------------------------------------------------- .../org/apache/beam/sdk/options/ProxyInvocationHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/9df033cb/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ProxyInvocationHandler.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ProxyInvocationHandler.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ProxyInvocationHandler.java index 0c10c2f..cb69979 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ProxyInvocationHandler.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ProxyInvocationHandler.java @@ -66,10 +66,10 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Random; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; +import java.util.concurrent.ThreadLocalRandom; import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; @@ -94,8 +94,8 @@ class ProxyInvocationHandler implements InvocationHandler, HasDisplayData { * No two instances of this class are considered equivalent hence we generate a random hash code * between 0 and {@link Integer#MAX_VALUE}. */ - private final int hashCode = (RANDOM.nextInt() * Integer.MAX_VALUE); - private static final Random RANDOM = new Random(); + private final int hashCode = ThreadLocalRandom.current().nextInt( + Integer.MIN_VALUE, Integer.MAX_VALUE); private final Set> knownInterfaces; private final ClassToInstanceMap interfaceToProxyCache; private final Map options;