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 64357 Details for
Bug 183286
JobManager can get into a state where same job is running in two threads at once
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]
Fix
patch.txt (text/plain), 3.64 KB, created by
John Arthorne
on 2007-04-19 17:16:20 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2007-04-19 17:16:20 EDT
Size:
3.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.jobs >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.6 >diff -u -r1.6 InternalJob.java >--- src/org/eclipse/core/internal/jobs/InternalJob.java 25 Jan 2007 23:09:09 -0000 1.6 >+++ src/org/eclipse/core/internal/jobs/InternalJob.java 19 Apr 2007 21:08:20 -0000 >@@ -42,6 +42,11 @@ > private static final int M_STATE = 0xFF; > private static final int M_SYSTEM = 0x0100; > private static final int M_USER = 0x0200; >+ >+ /* >+ * flag on a job indicating that it was about to run, but has been canceled >+ */ >+ private static final int M_ABOUT_TO_RUN_CANCELED = 0x0400; > > protected static final JobManager manager = JobManager.getInstance(); > private static int nextJobNumber = 0; >@@ -268,6 +273,13 @@ > flags = (flags & ~M_STATE) | i; > } > >+ /** >+ * Returns whether this job was canceled when it was about to run >+ */ >+ final boolean isAboutToRunCanceled(){ >+ return (flags & M_ABOUT_TO_RUN_CANCELED) != 0; >+ } >+ > /* (non-Javadoc) > * @see Job#isBlocking() > */ >@@ -355,6 +367,14 @@ > if (shouldSchedule()) > manager.schedule(this, delay, false); > } >+ >+ /** >+ * Sets whether this job was canceled when it was about to run >+ */ >+ final void setAboutToRunCanceled(boolean value) { >+ flags = value ? flags | M_ABOUT_TO_RUN_CANCELED : flags & ~M_ABOUT_TO_RUN_CANCELED; >+ >+ } > > /* (non-Javadoc) > * @see Job#setName(String) >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.24 >diff -u -r1.24 JobManager.java >--- src/org/eclipse/core/internal/jobs/JobManager.java 27 Mar 2007 20:57:50 -0000 1.24 >+++ src/org/eclipse/core/internal/jobs/JobManager.java 19 Apr 2007 21:08:20 -0000 >@@ -57,7 +57,6 @@ > static boolean DEBUG_TIMING = false; > static boolean DEBUG_SHUTDOWN = false; > private static DateFormat DEBUG_FORMAT; >- private static final IProgressMonitor NULL_MONITOR = new NullProgressMonitor(); > > /** > * The singleton job manager instance. It must be a singleton because >@@ -241,7 +240,9 @@ > monitor = job.getProgressMonitor(); > break; > } >- //fall through for ABOUT_TO_RUN case >+ //signal that the job should be canceled before it gets a chance to run >+ job.setAboutToRunCanceled(true); >+ return true; > default : > changeState(job, Job.NONE); > } >@@ -538,7 +539,7 @@ > if (JobManager.DEBUG && notify) > JobManager.debug("Ending job: " + job); //$NON-NLS-1$ > job.setResult(result); >- job.setProgressMonitor(NULL_MONITOR); >+ job.setProgressMonitor(null); > job.setThread(null); > rescheduleDelay = job.getStartTime(); > changeState(job, Job.NONE); >@@ -1125,10 +1126,15 @@ > synchronized (lock) { > if (job.getState() == Job.RUNNING) { > InternalJob internal = job; >- internal.setProgressMonitor(createMonitor(job)); >- //change from ABOUT_TO_RUN to RUNNING >- internal.internalSetState(Job.RUNNING); >- break; >+ if (internal.isAboutToRunCanceled()) { >+ internal.setAboutToRunCanceled(false); >+ //fall through and end the job below >+ } else { >+ internal.setProgressMonitor(createMonitor(job)); >+ //change from ABOUT_TO_RUN to RUNNING >+ internal.internalSetState(Job.RUNNING); >+ break; >+ } > } > } > }
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 183286
: 64357