From bfbb439e09596671c3019e3f53da16792e9b8c95 Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 4 Mar 2010 00:42:10 +0000 Subject: Make sure discovered remote service description and sca config is registered first before the listeners are notified git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@918796 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/osgi/service/discovery/impl/LocalDiscoveryService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org') diff --git a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java index 89fd9ab853..320443c399 100644 --- a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java +++ b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java @@ -129,7 +129,7 @@ public class LocalDiscoveryService extends AbstractDiscoveryService implements B } public Object addingBundle(Bundle bundle, BundleEvent event) { - if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null) { + if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null || bundle.getBundleId() == 0) { // Ignore fragments return null; } @@ -157,6 +157,9 @@ public class LocalDiscoveryService extends AbstractDiscoveryService implements B // throw new ServiceRuntimeException(e); } } + + // Add to the extenders before notifying the listeners (the endpoints may references to the config) + this.extenders.add(extender); // Notify for (ServiceDescriptions sds : extender.getRemoteServiceDescriptions()) { @@ -167,7 +170,6 @@ public class LocalDiscoveryService extends AbstractDiscoveryService implements B } } - this.extenders.add(extender); return extender; } -- cgit v1.2.3