[ 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