hudson.model.Queue.Item Java Examples
The following examples show how to use
hudson.model.Queue.Item.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubBuildScheduler.java From DotCi with MIT License | 6 votes |
public void cancelSubBuilds(final PrintStream logger) { final Queue q = getJenkins().getQueue(); synchronized (q) { final int n = this.dynamicBuild.getNumber(); for (final Item i : q.getItems()) { final ParentBuildAction parentBuildAction = i.getAction(ParentBuildAction.class); if (parentBuildAction != null && this.dynamicBuild.equals(parentBuildAction.getParent())) { q.cancel(i); } } for (final DynamicSubProject c : this.dynamicBuild.getAllSubProjects()) { final DynamicSubBuild b = c.getBuildByNumber(n); if (b != null && b.isBuilding()) { final Executor exe = b.getExecutor(); if (exe != null) { logger.println(Messages.MatrixBuild_Interrupting(ModelHyperlinkNote.encodeTo(b))); exe.interrupt(); } } } } }
Example #2
Source File: DockerQueueListener.java From docker-plugin with MIT License | 5 votes |
/** * Helper method to determine the template from a given item. * * @param item Item which includes a template. * @return If the item includes a template then the template will be returned. Otherwise <code>null</code>. */ @CheckForNull private static DockerJobTemplateProperty getJobTemplate(Item item) { if (item.task instanceof Project) { final Project<?, ?> project = (Project<?, ?>) item.task; final DockerJobTemplateProperty p = project.getProperty(DockerJobTemplateProperty.class); if (p != null) return p; // backward compatibility. DockerJobTemplateProperty used to be a nested object in DockerJobProperty final DockerJobProperty property = project.getProperty(DockerJobProperty.class); if (property != null) { return property.getDockerJobTemplate(); } } return null; }
Example #3
Source File: SubBuildScheduler.java From DotCi with MIT License | 5 votes |
public CurrentBuildState waitForCompletion(final DynamicSubProject c, final TaskListener listener) throws InterruptedException { // wait for the completion int appearsCancelledCount = 0; while (true) { Thread.sleep(1000); final CurrentBuildState b = c.getCurrentStateByNumber(this.dynamicBuild.getNumber()); if (b != null) { // its building or is done if (b.isBuilding()) { continue; } else { final Result buildResult = b.getResult(); if (buildResult != null) { return b; } } } else { // not building or done, check queue final Queue.Item qi = c.getQueueItem(); if (qi == null) { appearsCancelledCount++; listener.getLogger().println(c.getName() + " appears cancelled: " + appearsCancelledCount); } else { appearsCancelledCount = 0; } if (appearsCancelledCount >= 5) { listener.getLogger().println(Messages.MatrixBuild_AppearsCancelled(ModelHyperlinkNote.encodeTo(c))); return new CurrentBuildState("COMPLETED", Result.ABORTED); } } } }
Example #4
Source File: DbBackedProject.java From DotCi with MIT License | 5 votes |
@Override public synchronized Item getQueueItem() { final Queue queue = Jenkins.getInstance().getQueue(); final Item[] items = queue.getItems(); for (int i = 0; i < items.length; i++) { if (items[i].task != null && items[i].task.equals(this)) { return items[i]; } } return super.getQueueItem(); }
Example #5
Source File: LockableResource.java From lockable-resources-plugin with MIT License | 5 votes |
public Task getTask() { Item item = Queue.getInstance().getItem(queueItemId); if (item != null) { return item.task; } else { return null; } }
Example #6
Source File: GitHubParametersAction.java From github-integration-plugin with MIT License | 4 votes |
@Override public void foldIntoExisting(Item item, Task owner, List<Action> actions) { item.addOrReplaceAction(this); }
Example #7
Source File: DbBackedProject.java From DotCi with MIT License | 4 votes |
@Override public void onLoad(final ItemGroup<? extends hudson.model.Item> parent, final String name) throws IOException { initRepos(); super.onLoad(parent, name); }