Return-Path: X-Original-To: apmail-accumulo-dev-archive@www.apache.org Delivered-To: apmail-accumulo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD31318F1E for ; Thu, 11 Feb 2016 22:31:23 +0000 (UTC) Received: (qmail 75657 invoked by uid 500); 11 Feb 2016 22:31:23 -0000 Delivered-To: apmail-accumulo-dev-archive@accumulo.apache.org Received: (qmail 75615 invoked by uid 500); 11 Feb 2016 22:31:23 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 75598 invoked by uid 99); 11 Feb 2016 22:31:23 -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, 11 Feb 2016 22:31:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5ACF1E0534; Thu, 11 Feb 2016 22:31:23 +0000 (UTC) From: joshelser To: dev@accumulo.apache.org Reply-To: dev@accumulo.apache.org References: In-Reply-To: Subject: [GitHub] accumulo pull request: ACCUMULO-4143 Make protective copy of migra... Content-Type: text/plain Message-Id: <20160211223123.5ACF1E0534@git1-us-west.apache.org> Date: Thu, 11 Feb 2016 22:31:23 +0000 (UTC) Github user joshelser commented on a diff in the pull request: https://github.com/apache/accumulo/pull/68#discussion_r52678587 --- Diff: server/master/src/main/java/org/apache/accumulo/master/Master.java --- @@ -1336,7 +1332,11 @@ public void assignedTablet(KeyExtent extent) { } @Override - public Collection migrations() { - return migrations.keySet(); + public Set migrations() { + Set migrationsCopy = new HashSet(); + synchronized (migrations) { + migrationsCopy.addAll(migrations.keySet()); + } + return migrationsCopy; --- End diff -- > We could change the interface method name to "migrationsSnapshot()" to be clear, though, and to avoid careless future impl changes which change that semantics. :+1: I like this general approach. I think migrations are just one place that we follow this pattern and could benefit from more descriptive method names. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---