diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-27 04:33:47 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-27 04:33:47 +0000 |
commit | 0c1527f0415fb7d6c06b0ad2a1d4ce73cd728852 (patch) | |
tree | 7d0658a2e64c4fdec2957090fc70dfd0efed09d7 /sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java | |
parent | c2dfd0917dbb0793b7934ccc298e03187e6e3418 (diff) |
Fix multiple concurrency related issues
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@903542 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoverer.java | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoverer.java b/sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoverer.java index 31a3ae3b9c..56b889b607 100644 --- a/sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoverer.java +++ b/sca-java-2.x/trunk/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoverer.java @@ -79,6 +79,26 @@ public class EquinoxServiceDiscoverer implements ServiceDiscoverer { } return scaVersion; } + + /* + private Map<Bundle, Object> bundles = new ConcurrentHashMap<Bundle, Object>(); + + public Object addingBundle(Bundle bundle, BundleEvent event) { + if (isProviderBundle(bundle)) { + bundles.put(bundle, bundle); + System.out.println("Bundle added: " + toString(bundle)); + return bundle; + } + return null; + } + + public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) { + } + + public void removedBundle(Bundle bundle, BundleEvent event, Object object) { + bundles.remove(object); + } + */ public static class ServiceDeclarationImpl implements ServiceDeclaration { private Bundle bundle; @@ -211,6 +231,17 @@ public class EquinoxServiceDiscoverer implements ServiceDiscoverer { } return true; } + + protected Collection<Bundle> getBundles() { + // return bundles.keySet(); + Set<Bundle> set = new HashSet<Bundle>(); + for (Bundle b : context.getBundles()) { + if (isProviderBundle(b)) { + set.add(b); + } + } + return set; + } public Collection<ServiceDeclaration> getServiceDeclarations(String serviceName) throws IOException { boolean debug = logger.isLoggable(Level.FINE); @@ -222,10 +253,10 @@ public class EquinoxServiceDiscoverer implements ServiceDiscoverer { Set<URL> visited = new HashSet<URL>(); //System.out.println(">>>> getServiceDeclarations()"); - for (Bundle bundle : context.getBundles()) { - if (!isProviderBundle(bundle)) { - continue; - } + for (Bundle bundle : getBundles()) { +// if (!isProviderBundle(bundle)) { +// continue; +// } Enumeration<URL> urls = null; try { // Use getResources to find resources on the classpath of the bundle |