Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E90A9171D6 for ; Thu, 24 Sep 2015 13:39:51 +0000 (UTC) Received: (qmail 78707 invoked by uid 500); 24 Sep 2015 13:39:51 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 78602 invoked by uid 500); 24 Sep 2015 13:39:51 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 78583 invoked by uid 99); 24 Sep 2015 13:39:51 -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, 24 Sep 2015 13:39:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A4808E10C6; Thu, 24 Sep 2015 13:39:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Thu, 24 Sep 2015 13:39:52 -0000 Message-Id: In-Reply-To: <1f5388c3a6a74fc98e8b2cec8a338e4d@git.apache.org> References: <1f5388c3a6a74fc98e8b2cec8a338e4d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] camel git commit: No need for sync in that guice unit test as reported by some code scanner tools. No need for sync in that guice unit test as reported by some code scanner tools. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/92c4a815 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/92c4a815 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/92c4a815 Branch: refs/heads/master Commit: 92c4a815b273e8d76dc3da539aa766a397fd02d5 Parents: 21b72c0 Author: Claus Ibsen Authored: Thu Sep 24 15:41:20 2015 +0200 Committer: Claus Ibsen Committed: Thu Sep 24 15:41:20 2015 +0200 ---------------------------------------------------------------------- .../apache/camel/guice/testing/InjectorManager.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/92c4a815/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java ---------------------------------------------------------------------- diff --git a/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java b/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java index a01a5d3..25d0129 100644 --- a/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java +++ b/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java @@ -15,6 +15,7 @@ * limitations under the License. */ package org.apache.camel.guice.testing; + import java.lang.reflect.Modifier; import java.util.Map; import java.util.Map.Entry; @@ -36,7 +37,6 @@ import org.apache.camel.guice.util.CloseableScope; /** * Used to manage the injectors for the various injection points - * */ public class InjectorManager { private static final String NESTED_MODULE_CLASS = "TestModule"; @@ -97,14 +97,11 @@ public class InjectorManager { Class testType = test.getClass(); moduleType = getModuleForTestClass(testType); - Injector classInjector; - synchronized (injectors) { - classInjector = injectors.get(moduleType); - if (classInjector == null) { - classInjector = createInjector(moduleType); - Preconditions.checkNotNull(classInjector, "classInjector"); - injectors.put(moduleType, classInjector); - } + Injector classInjector = injectors.get(moduleType); + if (classInjector == null) { + classInjector = createInjector(moduleType); + Preconditions.checkNotNull(classInjector, "classInjector"); + injectors.put(moduleType, classInjector); } injectors.put(testType, classInjector); @@ -147,7 +144,6 @@ public class InjectorManager { CloseErrors errors = new CloseErrorsImpl(this); Set> entries = injectors.entrySet(); for (Entry entry : entries) { - // Object key = entry.getKey(); Injector injector = entry.getValue(); Injectors.close(injector, errors); }