Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 33eadd583df7d6fb8a0b75a63b143d2cb1f1321e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*******************************************************************************
 * Copyright (c) 2007 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
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.core.internal.registry.osgi;

import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.spi.RegistryStrategy;

/**
 * Use Eclipse job scheduling mechanism.
 */
final public class ExtensionEventDispatcherJob extends Job {
	// an "identy rule" that forces extension events to be queued		
	private final static ISchedulingRule EXTENSION_EVENT_RULE = new ISchedulingRule() {
		@Override
		public boolean contains(ISchedulingRule rule) {
			return rule == this;
		}

		@Override
		public boolean isConflicting(ISchedulingRule rule) {
			return rule == this;
		}
	};
	private Map deltas;
	private Object[] listenerInfos;
	private Object registry;

	public ExtensionEventDispatcherJob(Object[] listenerInfos, Map deltas, Object registry) {
		// name not NL'd since it is a system job
		super("Registry event dispatcher"); //$NON-NLS-1$
		setSystem(true);
		this.listenerInfos = listenerInfos;
		this.deltas = deltas;
		this.registry = registry;
		// all extension event dispatching jobs use this rule
		setRule(EXTENSION_EVENT_RULE);
	}

	@Override
	public IStatus run(IProgressMonitor monitor) {
		return RegistryStrategy.processChangeEvent(listenerInfos, deltas, registry);
	}
}

Back to the top