Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsboshev2009-08-03 15:49:03 +0000
committersboshev2009-08-03 15:49:03 +0000
commit699e5e2a624059f79d372f078cc39e2adb02eba9 (patch)
tree8b3c2f320ba97c24a2167ca1a7dce6b950b2fb60
parente260521a8a1694cddf3e7539e8361250846919a6 (diff)
downloadrt.equinox.bundles-699e5e2a624059f79d372f078cc39e2adb02eba9.tar.gz
rt.equinox.bundles-699e5e2a624059f79d372f078cc39e2adb02eba9.tar.xz
rt.equinox.bundles-699e5e2a624059f79d372f078cc39e2adb02eba9.zip
Bug 282563. [ds] RCP using declarative services (occasionally) hangs for 30 secs on start-upR35x_v20090803
-rw-r--r--bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/SCRManager.java29
-rw-r--r--bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/WorkThread.java3
2 files changed, 20 insertions, 12 deletions
diff --git a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/SCRManager.java b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/SCRManager.java
index 233bcfb05..e456995df 100644
--- a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/SCRManager.java
+++ b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/SCRManager.java
@@ -629,19 +629,24 @@ public class SCRManager implements ServiceListener, SynchronousBundleListener, C
}
// store the components in the cache
bundleToServiceComponents.put(bundle, components.clone());
- // this will also resolve the component dependencies!
- enqueueWork(this, ENABLE_COMPONENTS, components, false);
- synchronized (components) {
- long startTime = System.currentTimeMillis();
- try {
- do {
- components.wait(1000);
- } while (!components.isEmpty() && (System.currentTimeMillis() - startTime < WorkThread.BLOCK_TIMEOUT));
- if (System.currentTimeMillis() - startTime >= WorkThread.BLOCK_TIMEOUT) {
- Activator.log.warning(NLS.bind(Messages.TIMEOUT_REACHED_ENABLING_COMPONENTS, getBundleName(bundle), Integer.toString(WorkThread.BLOCK_TIMEOUT)), null);
+ if (workThread != null && workThread.processingThread == Thread.currentThread()) {
+ //we are in the queue thread already. Processing synchronously the job
+ resolver.enableComponents(components);
+ } else {
+ // this will also resolve the component dependencies!
+ enqueueWork(this, ENABLE_COMPONENTS, components, false);
+ synchronized (components) {
+ long startTime = System.currentTimeMillis();
+ try {
+ do {
+ components.wait(1000);
+ } while (!components.isEmpty() && (System.currentTimeMillis() - startTime < WorkThread.BLOCK_TIMEOUT));
+ if (System.currentTimeMillis() - startTime >= WorkThread.BLOCK_TIMEOUT) {
+ Activator.log.warning(NLS.bind(Messages.TIMEOUT_REACHED_ENABLING_COMPONENTS, getBundleName(bundle), Integer.toString(WorkThread.BLOCK_TIMEOUT)), null);
+ }
+ } catch (InterruptedException e) {
+ //do nothing
}
- } catch (InterruptedException e) {
- //do nothing
}
}
}
diff --git a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/WorkThread.java b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/WorkThread.java
index 56ddc0342..7ae2b1d07 100644
--- a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/WorkThread.java
+++ b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/WorkThread.java
@@ -31,6 +31,7 @@ public class WorkThread implements Runnable, TimerListener {
private SCRManager mgr;
private Object objectToProcess;
boolean running = true;
+ Thread processingThread;
int waiting = 0;
@@ -43,6 +44,7 @@ public class WorkThread implements Runnable, TimerListener {
* ManagedService(Factories) are informed for the event.
*/
public void run() {
+ processingThread = Thread.currentThread();
do {
try {
Queue queue = mgr.queue;
@@ -97,6 +99,7 @@ public class WorkThread implements Runnable, TimerListener {
}
} while (running);
objectToProcess = null;
+ processingThread = null;
}
public void timer(int event) {

Back to the top