Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/osgi
diff options
context:
space:
mode:
authorslewis2018-05-16 18:22:49 -0400
committerslewis2018-05-16 18:22:49 -0400
commit4e0732bceb44999cc0ca63a90a044dc88795905f (patch)
tree1de6e0a3cd234bb9cf2478b7776719fe13fea052 /osgi
parentd9dca4c6ffcb32f80523b16ed900598c90d667ef (diff)
downloadorg.eclipse.ecf-4e0732bceb44999cc0ca63a90a044dc88795905f.tar.gz
org.eclipse.ecf-4e0732bceb44999cc0ca63a90a044dc88795905f.tar.xz
org.eclipse.ecf-4e0732bceb44999cc0ca63a90a044dc88795905f.zip
Second final fix for bndtools-imposed start structure
Diffstat (limited to 'osgi')
-rw-r--r--osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManagerImpl.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManagerImpl.java b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManagerImpl.java
index 555f6f70d..5ff284d94 100644
--- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManagerImpl.java
+++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManagerImpl.java
@@ -13,6 +13,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.Activator;
import org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager;
@@ -146,22 +147,25 @@ public class TopologyManagerImpl extends AbstractTopologyManager implements Endp
final CountDownLatch latch = new CountDownLatch(1);
BundleTracker bt = new BundleTracker<Bundle>(getContext(),Bundle.INSTALLED | Bundle.RESOLVED |
Bundle.STARTING | Bundle.START_TRANSIENT | Bundle.ACTIVE , new BundleTrackerCustomizer() {
-
public Bundle addingBundle(Bundle bundle, BundleEvent event) {
if (bundle.getSymbolicName().equals(Activator.PLUGIN_ID))
return bundle;
return null;
}
-
public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) {
if (event.getType() == BundleEvent.STARTED)
latch.countDown();
}
-
public void removedBundle(Bundle bundle, BundleEvent event, Object object) {}
});
bt.open();
- latch.await(STARTUP_WAIT_TIME, TimeUnit.MILLISECONDS);
+ // wait STARTUP_WAIT_TIME for latch going to zero
+ if (!latch.await(STARTUP_WAIT_TIME, TimeUnit.MILLISECONDS)) {
+ bt.close();
+ throw new TimeoutException("RemoteServiceAdmin did not become active in "+STARTUP_WAIT_TIME+"ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ // Otherwise we close bundle tracker and register remote services
+ bt.close();
final ServiceReference[] existingServiceRefs = getContext().getAllServiceReferences(null,
exportRegisteredSvcsFilter);
// Now export as if the service was registering right now...i.e.

Back to the top