Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-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 0DB73DF45 for ; Thu, 13 Dec 2012 17:20:14 +0000 (UTC) Received: (qmail 60875 invoked by uid 500); 13 Dec 2012 17:20:13 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 60446 invoked by uid 500); 13 Dec 2012 17:20:12 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 60024 invoked by uid 99); 13 Dec 2012 17:20:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2012 17:20:12 +0000 Date: Thu, 13 Dec 2012 17:20:12 +0000 (UTC) From: "Guillaume Nodet (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FELIX-3807) Refreshing bundles should first grab all the bundle locks to avoid concurrent modifications of those bundles MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FELIX-3807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13531204#comment-13531204 ] Guillaume Nodet commented on FELIX-3807: ---------------------------------------- Revised patch {code} diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java index 5caf1d3..86f75b6 100644 --- a/framework/src/main/java/org/apache/felix/framework/Felix.java +++ b/framework/src/main/java/org/apache/felix/framework/Felix.java @@ -4978,18 +4978,21 @@ public class Felix extends BundleImpl implements Framework public void stop() { -// TODO: LOCKING - This is not really correct. - if (m_bundle.getState() == Bundle.ACTIVE) + acquireBundleLock(m_bundle, + Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | + Bundle.ACTIVE | Bundle.STOPPING); + try { - m_oldState = Bundle.ACTIVE; - try - { - stopBundle(m_bundle, false); - } - catch (Throwable ex) - { - fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex); - } + m_oldState = m_bundle.getState(); + stopBundle(m_bundle, false); + } + catch (Throwable ex) + { + fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex); + } + finally + { + releaseBundleLock(m_bundle); } } {code} > Refreshing bundles should first grab all the bundle locks to avoid concurrent modifications of those bundles > ------------------------------------------------------------------------------------------------------------ > > Key: FELIX-3807 > URL: https://issues.apache.org/jira/browse/FELIX-3807 > Project: Felix > Issue Type: Improvement > Components: Framework > Reporter: Guillaume Nodet > > This will avoid possible problems where bundles states can change between stopping the bundle and actually refreshing them. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira