diff options
author | slewis | 2008-08-01 05:49:19 +0000 |
---|---|---|
committer | slewis | 2008-08-01 05:49:19 +0000 |
commit | 6040ca08ffae11bc7036df46ce50be5b8c3b38ae (patch) | |
tree | b2a860de392e6a0248b221a4598d98f40ca75307 | |
parent | 31510a21113a7c1b35ae875b6afc56791ede1fc2 (diff) | |
download | org.eclipse.ecf-6040ca08ffae11bc7036df46ce50be5b8c3b38ae.tar.gz org.eclipse.ecf-6040ca08ffae11bc7036df46ce50be5b8c3b38ae.tar.xz org.eclipse.ecf-6040ca08ffae11bc7036df46ce50be5b8c3b38ae.zip |
Lengthened service timeout for discoveryService lookup.
2 files changed, 9 insertions, 4 deletions
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java index 1e4ccdbcc..11c9f8337 100644 --- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java +++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java @@ -13,8 +13,7 @@ package org.eclipse.ecf.internal.examples.remoteservices.server; import org.eclipse.ecf.discovery.service.IDiscoveryService; import org.eclipse.osgi.service.environment.EnvironmentInfo; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; +import org.osgi.framework.*; import org.osgi.util.tracker.ServiceTracker; /** @@ -31,6 +30,8 @@ public class Activator implements BundleActivator { private ServiceTracker discoveryTracker; + private Filter filter; + //private DiscoverableServer discoverableServer; /** @@ -50,7 +51,7 @@ public class Activator implements BundleActivator { public IDiscoveryService getDiscoveryService(int waittime) throws InterruptedException { if (discoveryTracker == null) { - discoveryTracker = new ServiceTracker(context, org.eclipse.ecf.discovery.service.IDiscoveryService.class.getName(), null); + discoveryTracker = new ServiceTracker(context, filter, null); discoveryTracker.open(); } return (IDiscoveryService) discoveryTracker.waitForService(waittime); @@ -63,6 +64,8 @@ public class Activator implements BundleActivator { public void start(BundleContext ctxt) throws Exception { plugin = this; this.context = ctxt; + filter = context.createFilter("(&(" + Constants.OBJECTCLASS + "=" + IDiscoveryService.class.getName() + ")(" + IDiscoveryService.CONTAINER_NAME + "=ecf.discovery.composite))"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + // create and start discoverable server //discoverableServer = new DiscoverableServer(); //String[] args = {}; diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java index a6e02b2bf..656b6a594 100644 --- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java +++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java @@ -87,7 +87,9 @@ public class DiscoverableServer implements IApplication { System.out.println("Registered remote service " + serviceClassName + " with " + serviceHostContainer + ",ID=" + serviceHostContainer.getID()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // then register for discovery - discoveryService = Activator.getDefault().getDiscoveryService(5000); + discoveryService = Activator.getDefault().getDiscoveryService(15000); + + Assert.isNotNull(discoveryService); final String serviceName = System.getProperty("user.name") + System.currentTimeMillis(); //$NON-NLS-1$ final IServiceID serviceID = ServiceIDFactory.getDefault().createServiceID(discoveryService.getServicesNamespace(), getCompleteServiceType(), serviceName); |