Class RunningJobs
java.lang.Object
com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.RunningJobs
Class for maintaining and synchronizing the runningJobs info.
Association between patches and the jobs that we're running for them.
-
Constructor Summary
ConstructorsConstructorDescriptionRunningJobs(GerritTrigger trigger, Item job) Constructor: embeds the trigger and it's underlying job into the tracked list. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Adds the event to the running jobs.voidcancelTriggeredJob(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event, String jobName, BuildCancellationPolicy policy) Called when trigger has cancellation policy associated with it.getJob()booleanremove(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Removes any reference to the current build for this change.voidscheduled(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Checks scheduled job and cancels current jobs if needed.void
-
Constructor Details
-
RunningJobs
Constructor: embeds the trigger and it's underlying job into the tracked list.- Parameters:
trigger- - gerrit trigger that has multiple running jobsjob- - underlying job of running build and triggers
-
-
Method Details
-
getJob
- Returns:
- the job
-
setJob
- Parameters:
job- the job to set
-
cancelTriggeredJob
public void cancelTriggeredJob(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event, String jobName, BuildCancellationPolicy policy) Called when trigger has cancellation policy associated with it.- Parameters:
event- event that is trigger buildsjobName- job name to match for specific cancellationpolicy- policy to decide cancelling build or not
-
scheduled
public void scheduled(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Checks scheduled job and cancels current jobs if needed. I.e. cancelling the old build if configured to do so and removing and storing any references. Only used by Server wide policy- Parameters:
event- the event triggering a new build.
-
add
public void add(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Adds the event to the running jobs.- Parameters:
event- The ChangeBasedEvent.
-
remove
public boolean remove(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Removes any reference to the current build for this change.- Parameters:
event- the event which started the build we want to remove.- Returns:
- true if event was still running.
-