本文整理汇总了Java中hudson.model.Queue.Executable方法的典型用法代码示例。如果您正苦于以下问题:Java Queue.Executable方法的具体用法?Java Queue.Executable怎么用?Java Queue.Executable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Queue
的用法示例。
在下文中一共展示了Queue.Executable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: done
import hudson.model.Queue; //导入方法依赖的package包/类
protected void done(Executor executor) {
final AbstractCloudComputer<?> c = (AbstractCloudComputer) executor.getOwner();
Queue.Executable exec = executor.getCurrentExecutable();
if (executor instanceof OneOffExecutor) {
LOG.debug("Not terminating {} because {} was a flyweight task", c.getName(), exec);
return;
}
if (exec instanceof ContinuableExecutable && ((ContinuableExecutable) exec).willContinue()) {
LOG.debug("not terminating {} because {} says it will be continued", c.getName(), exec);
return;
}
LOG.debug("terminating {} since {} seems to be finished", c.getName(), exec);
done(c);
}
示例2: if
import hudson.model.Queue; //导入方法依赖的package包/类
public static Run<?, ?> $build(FlowExecution execution) throws IOException {
if (execution != null) {
FlowExecutionOwner owner = execution.getOwner();
if (owner != null) {
Queue.Executable qe = owner.getExecutable();
if (qe instanceof Run) {
return (Run) qe;
}
}
}
return null;
}
示例3: done
import hudson.model.Queue; //导入方法依赖的package包/类
private void done(Executor executor) {
final DockerComputer c = (DockerComputer) executor.getOwner();
Queue.Executable exec = executor.getCurrentExecutable();
if (exec instanceof ContinuableExecutable && ((ContinuableExecutable) exec).willContinue()) {
LOGGER.log(Level.FINE, "not terminating {0} because {1} says it will be continued", new Object[]{c.getName(), exec});
return;
}
LOGGER.log(Level.FINE, "terminating {0} since {1} seems to be finished", new Object[]{c.getName(), exec});
done(c);
}
示例4: waitUntilNoActivityUpTo
import hudson.model.Queue; //导入方法依赖的package包/类
/**
* Waits until Hudson finishes building everything, including those in the queue, or fail the test
* if the specified timeout milliseconds is
*
* Ported from Jenkins 1.479.
*/
public void waitUntilNoActivityUpTo(int timeout) throws Exception {
long startTime = System.currentTimeMillis();
int streak = 0;
while (true) {
Thread.sleep(10);
if (isSomethingHappening())
streak=0;
else
streak++;
if (streak>5) // the system is quiet for a while
return;
if (System.currentTimeMillis()-startTime > timeout) {
List<Queue.Executable> building = new ArrayList<Queue.Executable>();
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
}
}
throw new AssertionError(String.format("Hudson is still doing something after %dms: queue=%s building=%s",
timeout, Arrays.asList(jenkins.getQueue().getItems()), building));
}
}
}
示例5: createExecutable
import hudson.model.Queue; //导入方法依赖的package包/类
@Override
public Queue.Executable createExecutable() throws IOException {
return new MyExecutable(this);
}
示例6: abortRunning
import hudson.model.Queue; //导入方法依赖的package包/类
public synchronized int abortRunning(int number) throws IllegalAccessException {
int aborted = 0;
Computer[] computers = getJenkinsInstance().getComputers();
for (Computer computer : computers) {
if (isNull(computer)) {
continue;
}
List<Executor> executors = computer.getExecutors();
executors.addAll(computer.getOneOffExecutors());
for (Executor executor : executors) {
if (isNull(executor) || !executor.isBusy() || nonNull(executor.getCauseOfDeath()) ||
!getInterruptCauses(executor).isEmpty() || getInterruptStatus(executor) == Result.ABORTED) {
continue;
}
Queue.Executable executable = executor.getCurrentExecutable();
final SubTask parent = executable.getParent();
if (!(executable instanceof Run)) {
continue;
}
final Run executableRun = (Run) executable;
if (!(parent instanceof Job)) {
continue;
}
final Job parentJob = (Job) parent;
if (!parentJob.getFullName().equals(job.getFullName())) {
// name doesn't match
continue;
}
if (executableRun.getResult() == Result.ABORTED) {
// was already aborted
continue;
}
if (executableRun instanceof MatrixRun) {
// the whole MatrixBuild will be aborted
continue;
}
// if (executable instanceof MatrixBuild) {
// final MatrixBuild executable1 = (MatrixBuild) executable;
// executable1.doStop()
// }
final GitHubPRCause causeAction = (GitHubPRCause) executableRun.getCause(GitHubPRCause.class);
if (nonNull(causeAction) && causeAction.getNumber() == number) {
LOGGER.info("Aborting '{}', by interrupting '{}'", executableRun, executor);
executor.interrupt(Result.ABORTED, new NewPRInterruptCause());
aborted++;
}
}
}
return aborted;
}
示例7: createExecutable
import hudson.model.Queue; //导入方法依赖的package包/类
public Queue.Executable createExecutable() throws IOException {
return new ExecutableImpl();
}