Class CreationItemListener
- java.lang.Object
-
- hudson.model.listeners.ItemListener
-
- hudson.plugins.project_inheritance.projects.creation.CreationItemListener
-
- All Implemented Interfaces:
ExtensionPoint
@Extension public class CreationItemListener extends ItemListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description CreationItemListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onCreated(Item item)
void
onDeleted(Item item)
static void
onJenkinsJobsGuaranteedLoaded()
This method does the same asonJenkinsStart()
, except that it has no reason to wait, since all static Jobs are guaranteed to have been created by then.static void
onJenkinsStart()
This function will wait until it thinks all static jobs have been loaded and then tries to generate the transients before letting Jenkins attain theInitMilestone.JOB_LOADED
milestone.void
onLoaded()
void
onRenamed(Item item, String oldName, String newName)
void
onUpdated(Item item)
-
Methods inherited from class hudson.model.listeners.ItemListener
all, checkBeforeCopy, fireLocationChange, fireOnCopied, fireOnCreated, fireOnDeleted, fireOnUpdated, onBeforeShutdown, onCheckCopy, onCopied, onLocationChanged, register
-
-
-
-
Method Detail
-
onCreated
public void onCreated(Item item)
- Overrides:
onCreated
in classItemListener
-
onRenamed
public void onRenamed(Item item, String oldName, String newName)
- Overrides:
onRenamed
in classItemListener
-
onUpdated
public void onUpdated(Item item)
- Overrides:
onUpdated
in classItemListener
-
onDeleted
public void onDeleted(Item item)
- Overrides:
onDeleted
in classItemListener
-
onLoaded
public void onLoaded()
- Overrides:
onLoaded
in classItemListener
-
onJenkinsStart
@Initializer(after=JOB_LOADED, fatal=false) public static void onJenkinsStart()
This function will wait until it thinks all static jobs have been loaded and then tries to generate the transients before letting Jenkins attain theInitMilestone.JOB_LOADED
milestone.Do note that this is just a time-based heuristic and is the only way to reliably trigger before Jenkins calls
Queue.init(Jenkins)
and restores aborted Runs from it.But since that is unreliable, we trigger the recreation again via
onJenkinsJobsGuaranteedLoaded()
.
-
onJenkinsJobsGuaranteedLoaded
@Initializer(after=JOB_LOADED, fatal=false) public static void onJenkinsJobsGuaranteedLoaded()
This method does the same asonJenkinsStart()
, except that it has no reason to wait, since all static Jobs are guaranteed to have been created by then. Unfortunately, Jenkins has most likely already calledQueue.init(Jenkins)
by this point, so the other function is also important.In other words, this functions ensures the reliable creation of all transient jobs; whereas the other one tries to promise a reliable restoration of jobs that were stuck in the previous Queue.
-
-