KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > jobs > ISchedulingRule


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM - Initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.jobs;
12
13 /**
14  * Scheduling rules are used by jobs to indicate when they need exclusive access
15  * to a resource. Scheduling rules can also be applied synchronously to a thread
16  * using <tt>IJobManager.beginRule(ISchedulingRule)</tt> and
17  * <tt>IJobManager.endRule(ISchedulingRule)</tt>. The job manager guarantees that
18  * no two jobs with conflicting scheduling rules will run concurrently.
19  * Multiple rules can be applied to a given thread only if the outer rule explicitly
20  * allows the nesting as specified by the <code>contains</code> method.
21  * <p>
22  * Clients may implement this interface.
23  *
24  * @see Job#getRule()
25  * @see Job#setRule(ISchedulingRule)
26  * @see Job#schedule(long)
27  * @see IJobManager#beginRule(ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor)
28  * @see IJobManager#endRule(ISchedulingRule)
29  * @since 3.0
30  */

31 public interface ISchedulingRule {
32     /**
33      * Returns whether this scheduling rule completely contains another scheduling
34      * rule. Rules can only be nested within a thread if the inner rule is completely
35      * contained within the outer rule.
36      * <p>
37      * Implementations of this method must obey the rules of a partial order relation
38      * on the set of all scheduling rules. In particular, implementations must be reflexive
39      * (a.contains(a) is always true), antisymmetric (a.contains(b) and b.contains(a) iff a.equals(b),
40      * and transitive (if a.contains(b) and b.contains(c), then a.contains(c)). Implementations
41      * of this method must return <code>false</code> when compared to a rule they
42      * know nothing about.
43      *
44      * @param rule the rule to check for containment
45      * @return <code>true</code> if this rule contains the given rule, and
46      * <code>false</code> otherwise.
47      */

48     public boolean contains(ISchedulingRule rule);
49
50     /**
51      * Returns whether this scheduling rule is compatible with another scheduling rule.
52      * If <code>true</code> is returned, then no job with this rule will be run at the
53      * same time as a job with the conflicting rule. If <code>false</code> is returned,
54      * then the job manager is free to run jobs with these rules at the same time.
55      * <p>
56      * Implementations of this method must be reflexive, symmetric, and consistent,
57      * and must return <code>false</code> when compared to a rule they know
58      * nothing about.
59      *
60      * @param rule the rule to check for conflicts
61      * @return <code>true</code> if the rule is conflicting, and <code>false</code>
62      * otherwise.
63      */

64     public boolean isConflicting(ISchedulingRule rule);
65 }
66
Popular Tags