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

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

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

Jenkins.getQueue介绍

暂无

代码示例

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

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

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

  1. /**
  2. * Returns the queue item if the owner is scheduled for execution in the queue, in REVERSE ORDER
  3. */
  4. public List<Item> getQueuedItems() {
  5. LinkedList<Item> list = new LinkedList<Item>();
  6. for (Item item : Jenkins.getInstance().getQueue().getItems()) {
  7. if (item.task == owner) {
  8. list.addFirst(item);
  9. }
  10. }
  11. return list;
  12. }

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns true if the build is in the queue.
  3. */
  4. @Override
  5. public boolean isInQueue() {
  6. return Jenkins.getInstance().getQueue().contains(this);
  7. }

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

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

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

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

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

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

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

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

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

  1. @Override
  2. protected int run() throws Exception {
  3. Jenkins.getActiveInstance().getQueue().clear();
  4. return 0;
  5. }

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

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

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

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

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

  1. /** @deprecated Use {@link #doCancelItem} instead. */
  2. @Deprecated
  3. @RequirePOST
  4. public HttpResponse doCancelQueue() throws IOException, ServletException {
  5. if(hasCancelPermission()){
  6. Jenkins.getInstance().getQueue().cancel(this);
  7. }
  8. return HttpResponses.forwardToPreviousPage();
  9. }

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

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

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

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

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

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

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

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

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

  1. protected void doRun() {
  2. Jenkins j = Jenkins.getInstance();
  3. List<Queue.BuildableItem> bis = j.getQueue().getBuildableItems();
  4. // update statistics on agents
  5. for( Label l : j.getLabels() ) {
  6. l.loadStatistics.updateCounts(l.loadStatistics.computeSnapshot(bis));
  7. }
  8. // update statistics of the entire system
  9. j.unlabeledLoad.updateCounts(j.unlabeledLoad.computeSnapshot(bis));
  10. j.overallLoad.updateCounts(j.overallLoad.computeSnapshot(bis));
  11. }

相关文章

Jenkins类方法