Class DependencyQueueTaskDispatcher

  • All Implemented Interfaces:
    GerritEventLifecycleListener, com.sonymobile.tools.gerrit.gerritevents.GerritEventListener, ExtensionPoint

    @Extension
    public final class DependencyQueueTaskDispatcher
    extends QueueTaskDispatcher
    implements GerritEventLifecycleListener, com.sonymobile.tools.gerrit.gerritevents.GerritEventListener
    Blocks builds from running until the projects on which they depend have finished building. This applies on a per-event basis, so for each event, the plugin will wait for dependency projects (i.e., projects on which it depends) which also trigger for the same event, to finish building before building a dependent project.
    Author:
    Yannick Bréhon <yannick.brehon@smartmatic.com>
    • Constructor Detail

      • DependencyQueueTaskDispatcher

        public DependencyQueueTaskDispatcher()
        Default constructor.
    • Method Detail

      • getInstance

        public static DependencyQueueTaskDispatcher getInstance()
        Returns the registered instance of this class from the list of all listeners.
        Returns:
        the instance.
      • getProjectsFromString

        public static List<Job> getProjectsFromString​(String projects,
                                                      Item context)
        Return a list of Abstract Projects from their string names.
        Parameters:
        projects - The string containing the projects, comma-separated.
        context - The context in which to read the string
        Returns:
        the list of projects
      • onTriggeringAll

        public void onTriggeringAll​(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
        Signals this event started retriggering all its projects. In the meantime, no builds with dependencies should be allowed to start.
        Parameters:
        event - the event triggering
      • onDoneTriggeringAll

        public void onDoneTriggeringAll​(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
        Signals this event is done retriggering all its projects. Builds with dependencies may be allowed to start once their dependencies are built..
        Parameters:
        event - the event done triggering
      • gerritEvent

        public void gerritEvent​(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
        Process lifecycle events. We register to these events so we can get notified of the beginning of the scanning and end of scanning.
        Specified by:
        gerritEvent in interface com.sonymobile.tools.gerrit.gerritevents.GerritEventListener
        Parameters:
        event - the event to which we subscribe.
      • projectTriggered

        public void projectTriggered​(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event,
                                     Job project)
        Description copied from interface: GerritEventLifecycleListener
        Called when the trigger of a project has decided to trigger on the event.
        Specified by:
        projectTriggered in interface GerritEventLifecycleListener
        Parameters:
        event - the event.
        project - the project that was triggered.