summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-01-19 05:37:38 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-01-19 05:37:38 +0000
commit9da25a6532fcbb9ae66294f1ff9ea903653c83e5 (patch)
treea3b91c4a580b096d5bdaa38c0be963f4968b7d28 /sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service
parent347f83ffa0b5cf5e69289dbf290c09b01a227c5c (diff)
Expose system definitions from the deployer
Add the removal of entries when the member leaves the group Add listeners to the hazelcastInstance git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@900661 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service')
-rw-r--r--sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
index f6e9855556..a7c6d04ee9 100644
--- a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
+++ b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
@@ -53,6 +53,19 @@ public class DomainDiscoveryService extends AbstractDiscoveryService implements
this.domainRegistryFactory =
registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(DomainRegistryFactory.class);
domainRegistryFactory.addListener(this);
+
+ // [rfeng] Starting of the endpoint registry takes a long time and it leaves the bundle
+ // state to be starting. When the registry is started, remote endpoints come in and that
+ // triggers the classloading from this bundle.
+ Thread thread = new Thread() {
+ public void run() {
+ startEndpointRegistry();
+ }
+ };
+ thread.start();
+ }
+
+ private void startEndpointRegistry() {
// The following code forced the start() of the domain registry in absense of services
String domainRegistry = context.getProperty("org.osgi.sca.domain.registry");
if (domainRegistry == null) {
@@ -103,6 +116,8 @@ public class DomainDiscoveryService extends AbstractDiscoveryService implements
{
// Notify the endpoint listeners
EndpointDescription description = createEndpointDescription(bundleContext, endpoint);
+ // Set the owning bundle to runtime bundle to avoid NPE
+ servicesInfo.put(description, context.getBundle());
endpointChanged(description, ADDED);
}
}
@@ -115,6 +130,7 @@ public class DomainDiscoveryService extends AbstractDiscoveryService implements
*/
{
EndpointDescription description = createEndpointDescription(context, endpoint);
+ servicesInfo.remove(description);
endpointChanged(description, REMOVED);
}
}