jenkins.model.Jenkins.getQueue()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中jenkins.model.Jenkins.getQueue()方法的一些代码示例,展示了Jenkins.getQueue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getQueue()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getQueue

Jenkins.getQueue介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Override
public Object fromString(String string) {
  return Jenkins.getInstance().getQueue();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the queue item if the owner is scheduled for execution in the queue, in REVERSE ORDER
 */
public List<Item> getQueuedItems() {
  LinkedList<Item> list = new LinkedList<Item>();
  for (Item item : Jenkins.getInstance().getQueue().getItems()) {
    if (item.task == owner) {
      list.addFirst(item);
    }
  }
  return list;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the time when this computer first became in demand.
 */
public final long getDemandStartMilliseconds() {
  long firstDemand = Long.MAX_VALUE;
  for (Queue.BuildableItem item : Jenkins.getInstance().getQueue().getBuildableItems(this)) {
    firstDemand = Math.min(item.buildableStartMilliseconds, firstDemand);
  }
  return firstDemand;
}

代码示例来源:origin: jenkinsci/jenkins

public Executor(@Nonnull Computer owner, int n) {
  super("Executor #"+n+" for "+owner.getDisplayName());
  this.owner = owner;
  this.queue = Jenkins.get().getQueue();
  this.number = n;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Wraps a {@link Runnable} with the  {@link Queue} lock held. 
 *
 * @param runnable the operation to wrap.
 * @since 1.618
 */
public static Runnable wrapWithLock(Runnable runnable) {
  final Jenkins jenkins = Jenkins.getInstanceOrNull();
  // TODO confirm safe to assume non-null and use getInstance()
  final Queue queue = jenkins == null ? null : jenkins.getQueue();
  return queue == null ? runnable : new LockedRunnable(runnable);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Wraps a {@link hudson.remoting.Callable} with the  {@link Queue} lock held. 
 *
 * @param callable the operation to wrap.
 * @since 1.618
 */
public static <V, T extends Throwable> hudson.remoting.Callable<V, T> wrapWithLock(hudson.remoting.Callable<V, T> callable) {
  final Jenkins jenkins = Jenkins.getInstanceOrNull();
  // TODO confirm safe to assume non-null and use getInstance()
  final Queue queue = jenkins == null ? null : jenkins.getQueue();
  return queue == null ? callable : new LockedHRCallable<>(callable);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns true if the build is in the queue.
 */
@Override
public boolean isInQueue() {
  return Jenkins.getInstance().getQueue().contains(this);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Restores the queue content during the start up.
 */
@Initializer(after=JOB_LOADED)
public static void init(Jenkins h) {
  h.getQueue().load();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Wraps a {@link java.util.concurrent.Callable} with the {@link Queue} lock held. 
 *
 * @param callable the operation to wrap.
 * @since 1.618
 */
public static <V> java.util.concurrent.Callable<V> wrapWithLock(java.util.concurrent.Callable<V> callable) {
  final Jenkins jenkins = Jenkins.getInstanceOrNull();
  // TODO confirm safe to assume non-null and use getInstance()
  final Queue queue = jenkins == null ? null : jenkins.getQueue();
  return queue == null ? callable : new LockedJUCCallable<V>(callable);
}

代码示例来源:origin: jenkinsci/jenkins

@Override
public int computeQueueLength() {
  return Jenkins.getInstance().getQueue().countBuildableItemsFor(Label.this);
}

代码示例来源:origin: jenkinsci/jenkins

@Override
public int computeQueueLength() {
  return Jenkins.getInstance().getQueue().strictCountBuildableItemsFor(null);
}

代码示例来源:origin: jenkinsci/jenkins

@Override
protected int run() throws Exception {
  Jenkins.getActiveInstance().getQueue().clear();
  return 0;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the first queue item if the owner is scheduled for execution in the queue.
 */
public Item getQueuedItem() {
  return Jenkins.getInstance().getQueue().getItem(owner);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * @deprecated Use {@link #getQueueItems()}. As of 1.607 the approximation is no longer needed.
 * @return The items in the queue.
 */
@Deprecated
public List<Queue.Item> getApproximateQueueItemsQuickly() {
  return filterQueue(Jenkins.getInstance().getQueue().getApproximateItemsQuickly());
}

代码示例来源:origin: jenkinsci/jenkins

/** @deprecated Use {@link #doCancelItem} instead. */
@Deprecated
@RequirePOST
public HttpResponse doCancelQueue() throws IOException, ServletException {
  if(hasCancelPermission()){
    Jenkins.getInstance().getQueue().cancel(this);
  }
  return HttpResponses.forwardToPreviousPage();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Cancel previous quiet down Jenkins - preparation for a restart
 */
@RequirePOST // TODO the cancel link needs to be updated accordingly
public synchronized HttpRedirect doCancelQuietDown() {
  checkPermission(ADMINISTER);
  isQuietingDown = false;
  getQueue().scheduleMaintenance();
  return new HttpRedirect(".");
}

代码示例来源:origin: jenkinsci/jenkins

@CheckForNull Queue.Item scheduleBuild2(int quietPeriod, List<Action> actions) {
  if (!asJob().isBuildable())
    return null;
  List<Action> queueActions = new ArrayList<Action>(actions);
  if (isParameterized() && Util.filter(queueActions, ParametersAction.class).isEmpty()) {
    queueActions.add(new ParametersAction(getDefaultParametersValues()));
  }
  return Jenkins.getInstance().getQueue().schedule2(asJob(), quietPeriod, queueActions).getItem();
}

代码示例来源:origin: jenkinsci/jenkins

@Override
@RequirePOST
public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  super.doConfigSubmit(req,rsp);
  updateTransientActions();
  // notify the queue as the project might be now tied to different node
  Jenkins.getInstance().getQueue().scheduleMaintenance();
  // this is to reflect the upstream build adjustments done above
  Jenkins.getInstance().rebuildDependencyGraphAsync();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Standard implementation of {@link ParameterizedJob#doCancelQueue}.
 */
@RequirePOST
public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  asJob().checkPermission(Item.CANCEL);
  Jenkins.getInstance().getQueue().cancel(asJob());
  rsp.forwardToPreviousPage(req);
}

代码示例来源:origin: jenkinsci/jenkins

protected void doRun() {
  Jenkins j = Jenkins.getInstance();
  List<Queue.BuildableItem> bis = j.getQueue().getBuildableItems();
  // update statistics on agents
  for( Label l : j.getLabels() ) {
    l.loadStatistics.updateCounts(l.loadStatistics.computeSnapshot(bis));
  }
  // update statistics of the entire system
  j.unlabeledLoad.updateCounts(j.unlabeledLoad.computeSnapshot(bis));
  j.overallLoad.updateCounts(j.overallLoad.computeSnapshot(bis));
}

相关文章

微信公众号

最新文章

更多

Jenkins类方法