mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
Fixed a race condition in the ScmTest test case.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@12974 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
907fc05c59
commit
87bb29d14e
3 files changed
+22
-2
No files matched your search
@@ -423,7 +423,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
|
||||
|
||||
Future<R> f = new AsyncFutureImpl<R>() {
|
||||
final RunListener r = new RunListener<AbstractBuild>(AbstractBuild.class) {
|
||||
public void onCompleted(AbstractBuild r, TaskListener listener) {
|
||||
public void onFinalized(AbstractBuild r) {
|
||||
if(r.getProject()==AbstractProject.this && r.getNumber()>n) {
|
||||
set((R)r);
|
||||
unregister();
|
||||
|
||||
@@ -920,6 +920,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
result = Result.FAILURE;
|
||||
LOGGER.warning(toString()+": No build result is set, so marking as failure. This shouldn't happen");
|
||||
}
|
||||
RunListener.fireFinalized(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,16 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
|
||||
* the build is considered completed, so its status cannot be changed anymore.
|
||||
*/
|
||||
public void onCompleted(R r, TaskListener listener) {}
|
||||
|
||||
|
||||
/**
|
||||
* Called after a build is moved to the {@link Run.State#COMPLETED} state.
|
||||
*
|
||||
* <p>
|
||||
* At this point, all the records related to a build is written down to the disk. As such,
|
||||
* {@link TaskListener} is no longer available. This happens later than {@link #onCompleted(Run, TaskListener)}.
|
||||
*/
|
||||
public void onFinalized(R r) {}
|
||||
|
||||
/**
|
||||
* Called when a build is started (i.e. it was in the queue, and will now start running
|
||||
* on an executor)
|
||||
@@ -89,4 +98,14 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
|
||||
l.onStarted(r,listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires the {@link #onFinalized(Run)} event.
|
||||
*/
|
||||
public static void fireFinalized(Run r) {
|
||||
for (RunListener l : LISTENERS) {
|
||||
if(l.targetType.isInstance(r))
|
||||
l.onFinalized(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user