Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhseeberger2008-08-19 09:52:21 +0000
committerhseeberger2008-08-19 09:52:21 +0000
commit80fc69a928aa48a242287f27d56c2e8574d33116 (patch)
treedb7097c9b035d5b1c1657d7ed9a443db22675c33
parent5d035a74474626f44a3aa7e49ef836da47e59553 (diff)
downloadrt.equinox.bundles-80fc69a928aa48a242287f27d56c2e8574d33116.tar.gz
rt.equinox.bundles-80fc69a928aa48a242287f27d56c2e8574d33116.tar.xz
rt.equinox.bundles-80fc69a928aa48a242287f27d56c2e8574d33116.zip
Bug 226461 - [aspects] Improve handling of service dynamics
Removing bundle/weavingservice entries from "storage" at bundle update. Small concurrency fix.
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java
index 58f25d520..8fdd6c3e3 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java
@@ -19,6 +19,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.equinox.service.weaving.ICachingService;
import org.eclipse.equinox.service.weaving.IWeavingService;
@@ -114,12 +115,14 @@ public class AspectJAdaptorFactory {
public void serviceChanged(final ServiceEvent event) {
if (event.getType() == ServiceEvent.REGISTERED) {
- final Iterator bundles = weavingServices.keySet()
+ final Iterator bundleEntries = weavingServices.entrySet()
.iterator();
synchronized (weavingServices) {
- while (bundles.hasNext()) {
- final Bundle bundle = (Bundle) bundles.next();
- if (weavingServices.get(bundle) == null) {
+ while (bundleEntries.hasNext()) {
+ final Entry entry = (Entry) bundleEntries.next();
+ final Bundle bundle = (Bundle) entry.getKey();
+ if (entry.getValue() == null) {
+ bundleEntries.remove();
supplementerRegistry
.updateInstalledBundle(bundle);
if (Debug.DEBUG_WEAVE)
@@ -130,12 +133,14 @@ public class AspectJAdaptorFactory {
}
}
if (event.getType() == ServiceEvent.UNREGISTERING) {
- final Iterator bundles = weavingServices.keySet()
+ final Iterator bundleEntries = weavingServices.entrySet()
.iterator();
synchronized (weavingServices) {
- while (bundles.hasNext()) {
- final Bundle bundle = (Bundle) bundles.next();
- if (weavingServices.get(bundle) != null) {
+ while (bundleEntries.hasNext()) {
+ final Entry entry = (Entry) bundleEntries.next();
+ final Bundle bundle = (Bundle) entry.getKey();
+ if (entry.getValue() != null) {
+ bundleEntries.remove();
supplementerRegistry
.updateInstalledBundle(bundle);
if (Debug.DEBUG_WEAVE)
@@ -209,7 +214,9 @@ public class AspectJAdaptorFactory {
(ClassLoader) loader, bundle, state, bundleDescription,
supplementerRegistry);
}
- weavingServices.put(bundle, weavingService);
+ synchronized (weavingServices) {
+ weavingServices.put(bundle, weavingService);
+ }
}
if (Debug.DEBUG_WEAVE)
Debug

Back to the top