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 90496200CAD for ; Mon, 15 May 2017 15:12:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8EFA3160BC1; Mon, 15 May 2017 13:12:03 +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 81B08160BD6 for ; Mon, 15 May 2017 15:12:02 +0200 (CEST) Received: (qmail 40928 invoked by uid 500); 15 May 2017 13:12:01 -0000 Mailing-List: contact commits-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list commits@karaf.apache.org Received: (qmail 40621 invoked by uid 99); 15 May 2017 13:12:01 -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; Mon, 15 May 2017 13:12:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5A530DFFB3; Mon, 15 May 2017 13:12:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gnodet@apache.org To: commits@karaf.apache.org Date: Mon, 15 May 2017 13:12:11 -0000 Message-Id: <5e09d5f6892f41549cf999f7cc016191@git.apache.org> In-Reply-To: <768545f3f8354b969724fa4c18da6beb@git.apache.org> References: <768545f3f8354b969724fa4c18da6beb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/11] karaf git commit: Use a TreeSet to make the code more obvious archived-at: Mon, 15 May 2017 13:12:03 -0000 Use a TreeSet to make the code more obvious Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/9b99ac74 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/9b99ac74 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/9b99ac74 Branch: refs/heads/master Commit: 9b99ac740fed65fc518e16088eb9a88194632b61 Parents: 0326b10 Author: Guillaume Nodet Authored: Mon May 15 14:57:51 2017 +0200 Committer: Guillaume Nodet Committed: Mon May 15 14:57:51 2017 +0200 ---------------------------------------------------------------------- .../karaf/features/internal/service/FeaturesServiceImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/9b99ac74/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java ---------------------------------------------------------------------- diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java index 44300e7..d4e7ce1 100644 --- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java +++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java @@ -714,12 +714,12 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall * Should not be called while holding a lock. */ protected Map> getFeatures() throws Exception { - List uris; + Set uris; synchronized (lock) { if (featureCache != null) { return featureCache; } - uris = new ArrayList<>(state.repositories); + uris = new TreeSet<>(state.repositories); } //the outer map's key is feature name, the inner map's key is feature version Map> map = new HashMap<>(); @@ -771,8 +771,7 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall } } synchronized (lock) { - if (uris.size() == state.repositories.size() - && state.repositories.containsAll(uris)) { + if (uris.equals(state.repositories)) { featureCache = map; } }