diff options
| author | Markus Keller | 2015-11-18 16:14:19 +0000 |
|---|---|---|
| committer | Markus Keller | 2016-01-13 12:56:07 +0000 |
| commit | 374c955735de619731b2a572a6996397dddadc6a (patch) | |
| tree | 161f8820112ebac20058378aca7011f937822861 | |
| parent | 98016ac5063fac8e347d1358d9544d1b1f60f0cc (diff) | |
| download | eclipse.platform.ui-374c955735de619731b2a572a6996397dddadc6a.tar.gz eclipse.platform.ui-374c955735de619731b2a572a6996397dddadc6a.tar.xz eclipse.platform.ui-374c955735de619731b2a572a6996397dddadc6a.zip | |
Bug 480076: Excessive threads created (more than 30,000) for some tests, on some machinesM20160120-1000M20160113-1000
| -rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java index 58b3044224c..c4dc1fbd669 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -501,7 +501,7 @@ public final class MutableActivityManager extends AbstractActivityManager } private void clearExpressions() { - IEvaluationService evaluationService = (IEvaluationService) PlatformUI + IEvaluationService evaluationService = PlatformUI .getWorkbench().getService(IEvaluationService.class); Iterator i = refsByActivityDefinition.values().iterator(); while (i.hasNext()) { @@ -719,7 +719,7 @@ public final class MutableActivityManager extends AbstractActivityManager // enabledWhen comes into play IEvaluationReference ref = (IEvaluationReference) refsByActivityDefinition .get(activityDefinition); - IEvaluationService evaluationService = (IEvaluationService) PlatformUI + IEvaluationService evaluationService = PlatformUI .getWorkbench().getService(IEvaluationService.class); boolean newRef = false; if (activityDefinition != null && evaluationService!=null) { @@ -929,13 +929,11 @@ public final class MutableActivityManager extends AbstractActivityManager */ private Job getUpdateJob() { if (deferredIdentifierJob == null) { - deferredIdentifierJob = new Job("Identifier Update Job") { //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor) - */ + deferredIdentifierJob = new Job("Activity Identifier Update") { //$NON-NLS-1$ @Override protected IStatus run(IProgressMonitor monitor) { + final Map identifierEventsByIdentifierId = new HashMap(); + while (!deferredIdentifiers.isEmpty()) { Identifier identifier = (Identifier) deferredIdentifiers.remove(0); Set activityIds = new HashSet(); @@ -953,21 +951,20 @@ public final class MutableActivityManager extends AbstractActivityManager if (activityIdsChanged) { IdentifierEvent identifierEvent = new IdentifierEvent(identifier, activityIdsChanged, false); - final Map identifierEventsByIdentifierId = new HashMap(1); identifierEventsByIdentifierId.put(identifier.getId(), identifierEvent); - UIJob notifyJob = new UIJob("Identifier Update Job") { //$NON-NLS-1$ - - @Override - public IStatus runInUIThread( - IProgressMonitor monitor) { - notifyIdentifiers(identifierEventsByIdentifierId); - return Status.OK_STATUS; - } - }; - notifyJob.setSystem(true); - notifyJob.schedule(); - } + } + } + if (!identifierEventsByIdentifierId.isEmpty()) { + UIJob notifyJob = new UIJob("Activity Identifier Update UI") { //$NON-NLS-1$ + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + notifyIdentifiers(identifierEventsByIdentifierId); + return Status.OK_STATUS; + } + }; + notifyJob.setSystem(true); + notifyJob.schedule(); } return Status.OK_STATUS; } |
