Class RunningJobs


  • public class RunningJobs
    extends Object
    Class for maintaining and synchronizing the runningJobs info. Association between patches and the jobs that we're running for them.
    • Constructor Summary

      Constructors 
      Constructor Description
      RunningJobs​(GerritTrigger trigger, Item job)
      Constructor: embeds the trigger and it's underlying job into the tracked list.
    • Constructor Detail

      • RunningJobs

        public RunningJobs​(GerritTrigger trigger,
                           Item job)
        Constructor: embeds the trigger and it's underlying job into the tracked list.
        Parameters:
        trigger - - gerrit trigger that has multiple running jobs
        job - - underlying job of running build and triggers
    • Method Detail

      • getJob

        public Item getJob()
        Returns:
        the job
      • setJob

        public void setJob​(Item job)
        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 builds
        jobName - job name to match for specific cancellation
        policy - 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.