Class DependencyQueueTaskDispatcher
- java.lang.Object
-
- hudson.model.queue.QueueTaskDispatcher
-
- com.sonyericsson.hudson.plugins.gerrit.trigger.dependency.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>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description DependencyQueueTaskDispatcher()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allBuildsCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Called when all builds triggered by the event are completed.void
buildCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Called when a build is completed.void
buildStarted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Called when a build has started.CauseOfBlockage
canRun(Queue.Item item)
void
gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Process lifecycle events.static DependencyQueueTaskDispatcher
getInstance()
Returns the registered instance of this class from the list of all listeners.static List<Job>
getProjectsFromString(String projects, Item context)
Return a list of Abstract Projects from their string names.void
onDoneTriggeringAll(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
Signals this event is done retriggering all its projects.void
onTriggeringAll(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
Signals this event started retriggering all its projects.void
projectTriggered(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Job project)
Called when the trigger of a project has decided to trigger on the event.void
triggerScanDone(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Called after all triggers has been enumerated.void
triggerScanStarting(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Called before any triggers are enumerated.-
Methods inherited from class hudson.model.queue.QueueTaskDispatcher
all, canTake, canTake
-
-
-
-
Method Detail
-
getInstance
public static DependencyQueueTaskDispatcher getInstance()
Returns the registered instance of this class from the list of all listeners.- Returns:
- the instance.
-
canRun
public CauseOfBlockage canRun(Queue.Item item)
- Overrides:
canRun
in classQueueTaskDispatcher
-
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 interfacecom.sonymobile.tools.gerrit.gerritevents.GerritEventListener
- Parameters:
event
- the event to which we subscribe.
-
triggerScanStarting
public void triggerScanStarting(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Description copied from interface:GerritEventLifecycleListener
Called before any triggers are enumerated.- Specified by:
triggerScanStarting
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.
-
triggerScanDone
public void triggerScanDone(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Description copied from interface:GerritEventLifecycleListener
Called after all triggers has been enumerated.- Specified by:
triggerScanDone
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.
-
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 interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.project
- the project that was triggered.
-
buildStarted
public void buildStarted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Description copied from interface:GerritEventLifecycleListener
Called when a build has started.- Specified by:
buildStarted
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.build
- the build.
-
buildCompleted
public void buildCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Description copied from interface:GerritEventLifecycleListener
Called when a build is completed.- Specified by:
buildCompleted
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.build
- the build.
-
allBuildsCompleted
public void allBuildsCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Description copied from interface:GerritEventLifecycleListener
Called when all builds triggered by the event are completed.- Specified by:
allBuildsCompleted
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.
-
-