Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86396 Details for
Bug 211799
Jobs with identical priority, delay and conflicting scheduling rules can run in a different order than they were scheduled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Work in progress
patch.txt (text/plain), 5.02 KB, created by
John Arthorne
on 2008-01-08 10:19:51 EST
(
hide
)
Description:
Work in progress
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2008-01-08 10:19:51 EST
Size:
5.02 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.jobs >Index: src/org/eclipse/core/internal/jobs/JobManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java,v >retrieving revision 1.26 >diff -u -r1.26 JobManager.java >--- src/org/eclipse/core/internal/jobs/JobManager.java 9 Jul 2007 19:27:07 -0000 1.26 >+++ src/org/eclipse/core/internal/jobs/JobManager.java 8 Jan 2008 15:16:34 -0000 >@@ -127,6 +127,11 @@ > */ > private final JobQueue waiting; > >+ /** >+ * Counter to record wait queue insertion order. >+ */ >+ private long waitQueueCounter; >+ > public static void debug(String msg) { > StringBuffer msgBuf = new StringBuffer(msg.length() + 40); > if (DEBUG_TIMING) { >@@ -319,6 +324,7 @@ > switch (newState) { > case Job.NONE : > job.setStartTime(InternalJob.T_NONE); >+ job.setWaitQueueStamp(InternalJob.T_NONE); > case InternalJob.BLOCKED : > break; > case Job.WAITING : >@@ -334,6 +340,7 @@ > case Job.RUNNING : > case InternalJob.ABOUT_TO_RUN : > job.setStartTime(InternalJob.T_NONE); >+ job.setWaitQueueStamp(InternalJob.T_NONE); > running.add(job); > break; > case InternalJob.ABOUT_TO_SCHEDULE : >@@ -443,6 +450,7 @@ > changeState(job, Job.SLEEPING); > } else { > job.setStartTime(System.currentTimeMillis() + delayFor(job.getPriority())); >+ job.setWaitQueueStamp(waitQueueCounter++); > changeState(job, Job.WAITING); > } > } >@@ -828,6 +836,7 @@ > InternalJob job = sleeping.peek(); > while (job != null && job.getStartTime() < now) { > job.setStartTime(now + delayFor(job.getPriority())); >+ job.setWaitQueueStamp(waitQueueCounter++); > changeState(job, Job.WAITING); > job = sleeping.peek(); > } >Index: src/org/eclipse/core/internal/jobs/InternalJob.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/InternalJob.java,v >retrieving revision 1.8 >diff -u -r1.8 InternalJob.java >--- src/org/eclipse/core/internal/jobs/InternalJob.java 27 Jun 2007 18:19:15 -0000 1.8 >+++ src/org/eclipse/core/internal/jobs/InternalJob.java 8 Jan 2008 15:16:34 -0000 >@@ -89,6 +89,14 @@ > * or -1 if the job should not be rescheduled. > */ > private long startTime; >+ >+ /** >+ * Stamp added when a job is added to the wait queue. Used to ensure >+ * jobs in the wait queue maintain their insertion order even if they are >+ * removed from the wait queue temporarily while blocked >+ */ >+ private long waitQueueStamp = T_NONE; >+ > /* > * The thread that is currently running this job > */ >@@ -538,4 +546,18 @@ > protected void wakeUp(long delay) { > manager.wakeUp(this, delay); > } >+ >+ /** >+ * @param waitQueueStamp The waitQueueStamp to set. >+ */ >+ void setWaitQueueStamp(long waitQueueStamp) { >+ this.waitQueueStamp = waitQueueStamp; >+ } >+ >+ /** >+ * @return Returns the waitQueueStamp. >+ */ >+ long getWaitQueueStamp() { >+ return waitQueueStamp; >+ } > } >Index: src/org/eclipse/core/internal/jobs/JobQueue.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobQueue.java,v >retrieving revision 1.3 >diff -u -r1.3 JobQueue.java >--- src/org/eclipse/core/internal/jobs/JobQueue.java 4 Apr 2006 20:35:58 -0000 1.3 >+++ src/org/eclipse/core/internal/jobs/JobQueue.java 8 Jan 2008 15:16:34 -0000 >@@ -72,7 +72,7 @@ > Assert.isTrue(newEntry.previous() == null); > InternalJob tail = dummy.next(); > //overtake lower priority jobs. Only overtake conflicting jobs if allowed to >- while (tail != dummy && tail.compareTo(newEntry) < 0 && (allowConflictOvertaking || !newEntry.isConflicting(tail))) >+ while (canOvertake(newEntry, tail)) > tail = tail.next(); > //new entry is smaller than tail > final InternalJob tailPrevious = tail.previous(); >@@ -83,6 +83,25 @@ > } > > /** >+ * Returns whether the new entry to overtake the existing queue entry. >+ * @param newEntry The entry to be added to the queue >+ * @param queueEntry The existing queue entry >+ */ >+ private boolean canOvertake(InternalJob newEntry, InternalJob queueEntry) { >+ //can never go past the end of the queue >+ if (queueEntry == dummy) >+ return false; >+ //if the new entry was already in the wait queue, ensure it is re-inserted in correct position (bug 211799) >+ if (newEntry.getWaitQueueStamp() > 0 && newEntry.getWaitQueueStamp() < queueEntry.getWaitQueueStamp()) >+ return true; >+ //if the new entry has lower priority, there is no need to overtake the existing entry >+ if (queueEntry.compareTo(newEntry) >= 0) >+ return false; >+ //the new entry has higher priority, but only overtake the existing entry if the queue allows it >+ return allowConflictOvertaking || !newEntry.isConflicting(queueEntry); >+ } >+ >+ /** > * Removes the given element from the queue. > */ > public void remove(InternalJob toRemove) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211799
:
84345
|
86396
|
90427