Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A0DF7189CD for ; Thu, 21 Jan 2016 01:23:28 +0000 (UTC) Received: (qmail 71194 invoked by uid 500); 21 Jan 2016 01:23:28 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 71163 invoked by uid 500); 21 Jan 2016 01:23:28 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 71153 invoked by uid 99); 21 Jan 2016 01:23:28 -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, 21 Jan 2016 01:23:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6FE64DFF93; Thu, 21 Jan 2016 01:23:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.apache.org Date: Thu, 21 Jan 2016 01:23:28 -0000 Message-Id: <047b8e16c8254f1384fa7f9c527bd628@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/6] incubator-brooklyn git commit: prevent deadlock if requests coming in during startup Repository: incubator-brooklyn Updated Branches: refs/heads/master 8303fea86 -> 511886099 prevent deadlock if requests coming in during startup Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/2354c486 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/2354c486 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/2354c486 Branch: refs/heads/master Commit: 2354c4867bc8de3e80bef200bf51424696a33dfc Parents: 2a432cf Author: Alex Heneveld Authored: Wed Jan 20 18:13:35 2016 +0000 Committer: Alex Heneveld Committed: Wed Jan 20 21:07:12 2016 +0000 ---------------------------------------------------------------------- .../core/mgmt/internal/AbstractManagementContext.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2354c486/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java ---------------------------------------------------------------------- diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java index d41e059..5d07ed6 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java @@ -372,10 +372,15 @@ public abstract class AbstractManagementContext implements ManagementContextInte return configMap; } + private Object locationRegistrySemaphore = new Object(); + @Override - public synchronized LocationRegistry getLocationRegistry() { - if (locationRegistry==null) locationRegistry = new BasicLocationRegistry(this); - return locationRegistry; + public LocationRegistry getLocationRegistry() { + // NB: can deadlock if synched on whole LMC + synchronized (locationRegistrySemaphore) { + if (locationRegistry==null) locationRegistry = new BasicLocationRegistry(this); + return locationRegistry; + } } @Override