You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:20:39 UTC
[sling-org-apache-sling-commons-classloader] 05/14: SLING-2122 :
SynchronousBundleListener might be called concurrently
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.commons.classloader-1.2.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-classloader.git
commit 1f859b96921b2043248dcffe9a389c9fa9f1ab10
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jul 4 07:04:02 2011 +0000
SLING-2122 : SynchronousBundleListener might be called concurrently
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/classloader@1142570 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/commons/classloader/impl/Activator.java | 26 ++++++++++++----------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java b/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
index 62095e0..d02d899 100644
--- a/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
+++ b/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
@@ -108,18 +108,20 @@ public class Activator implements SynchronousBundleListener, BundleActivator {
* @see org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)
*/
public void bundleChanged(BundleEvent event) {
- final boolean reload;
- if ( event.getType() == BundleEvent.RESOLVED ) {
- reload = this.service.isBundleUsed(event.getBundle().getBundleId())
- || this.service.hasUnresolvedPackages(event.getBundle());
- } else if ( event.getType() == BundleEvent.UNRESOLVED ) {
- reload = this.service.isBundleUsed(event.getBundle().getBundleId());
- } else {
- reload = false;
- }
- if ( reload ) {
- this.unregisterManagerFactory();
- this.registerManagerFactory();
+ synchronized ( this ) {
+ final boolean reload;
+ if ( event.getType() == BundleEvent.RESOLVED ) {
+ reload = this.service.isBundleUsed(event.getBundle().getBundleId())
+ || this.service.hasUnresolvedPackages(event.getBundle());
+ } else if ( event.getType() == BundleEvent.UNRESOLVED ) {
+ reload = this.service.isBundleUsed(event.getBundle().getBundleId());
+ } else {
+ reload = false;
+ }
+ if ( reload ) {
+ this.unregisterManagerFactory();
+ this.registerManagerFactory();
+ }
}
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.