|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.CheckPoint
public final class CheckPoint
Provides a mechanism for synchronizing build executions in the face of concurrent builds.
At certain points of a build, BuildStep
s and other extension points often need
to refer to what happened in its earlier build. For example, a SCM
check out
can run concurrently, but the changelog computation requires that the check out of the
earlier build has completed. Or if Hudson is sending out an e-mail, he needs to know
the result of the previous build, so that he can decide an e-mail is necessary or not.
Check pointing is a primitive mechanism to provide this sort of synchronization.
These methods can be only invoked from Executor
threads.
Each CheckPoint
instance represents unique check points. CheckPoint
instances are normally created as a static instance, because two builds of the same project
needs to refer to the same check point instance for synchronization to happen properly.
This class defines a few well-known check point instances. plugins can define their additional check points for their own use.
JUnitResultArchiver
provides a good example of how a Recorder
can
depend on its earlier result.
BuildStep.getRequiredMonitorService()
Field Summary | |
---|---|
static CheckPoint |
COMPLETED
CheckPoint that indicates that the build is completed. |
static CheckPoint |
CULPRITS_DETERMINED
CheckPoint that indicates that AbstractBuild.getCulprits() is computed. |
static CheckPoint |
MAIN_COMPLETED
CheckPoint that indicates that the build has finished executing the "main" portion
(Builder s in case of FreeStyleProject ) and now moving on to the post-build
steps. |
Constructor Summary | |
---|---|
CheckPoint(String internalName)
|
|
CheckPoint(String internalName,
Object identity)
For advanced uses. |
Method Summary | |
---|---|
void |
block()
Waits until the previous build in progress reaches a check point, identified by the given identifier, or until the current executor becomes the youngest build in progress. |
boolean |
equals(Object that)
|
int |
hashCode()
|
void |
report()
Records that the execution of the build has reached to a check point, idenified by the given identifier. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final CheckPoint CULPRITS_DETERMINED
CheckPoint
that indicates that AbstractBuild.getCulprits()
is computed.
public static final CheckPoint COMPLETED
CheckPoint
that indicates that the build is completed.
(Run.isBuilding()
==false)
public static final CheckPoint MAIN_COMPLETED
CheckPoint
that indicates that the build has finished executing the "main" portion
(Builder
s in case of FreeStyleProject
) and now moving on to the post-build
steps.
Constructor Detail |
---|
public CheckPoint(String internalName, Object identity)
public CheckPoint(String internalName)
internalName
- Name of this check point that's used in the logging, stack traces, debug messages, and so on.
This is not displayed to users. No need for i18n.Method Detail |
---|
public boolean equals(Object that)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public void report()
If the successive builds are waiting for this check point, they'll be released.
This method can be only called from an Executor
thread.
public void block() throws InterruptedException
Note that "previous build in progress" should be interpreted as "previous (build in progress)" instead of "(previous build) if it's in progress". This makes a difference around builds that are aborted or failed very early without reporting the check points. Imagine the following time sequence:
JUnitResultArchiver
JUnitResultArchiver
Using this method, build #3 correctly waits until the step 4. Because of this behavior,
the report()
/block()
pair can normally
be used without a try/finally block.
This method can be only called from an Executor
thread.
InterruptedException
- If the build (represented by the calling executor thread) is aborted while it's waiting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |