/** * Disconnect this computer. * * <p>If this is the master, no-op. This method may return immediately while the launch operation * happens asynchronously. * * @param cause Object that identifies the reason the node was disconnected. * @return {@link Future} to track the asynchronous disconnect operation. * @see #connect(boolean) * @since 1.320 */ public Future<?> disconnect(OfflineCause cause) { offlineCause = cause; if (Util.isOverridden(Computer.class, getClass(), "disconnect")) return disconnect(); // legacy subtypes that extend disconnect(). connectTime = 0; return Futures.precomputed(null); }
/** * Equivalent to {@code disconnect(null)} * * @deprecated as of 1.320. Use {@link #disconnect(OfflineCause)} and specify the cause. */ public Future<?> disconnect() { if (Util.isOverridden(Computer.class, getClass(), "disconnect", OfflineCause.class)) // if the subtype already derives disconnect(OfflineCause), delegate to it return disconnect(null); connectTime = 0; return Futures.precomputed(null); }
/** * Called by Hudson to allow markups to be added to the changelog text. * * <p>This method is invoked each time a page is rendered, so implementations of this method * should not take too long to execute. Also note that this method may be invoked concurrently by * multiple threads. * * <p>If there's any error during the processing, it should be recorded in {@link Logger} and the * method should return normally. * * @param build Build that owns this changelog. From here you can access broader contextual * information, like the project, or it settings. Never null. * @param change The changelog entry for which this method is adding markup. Never null. * @param text The text and markups. Implementation of this method is expected to add additional * annotations into this object. If other annotators are registered, the object may already * contain some markups when this method is invoked. Never null. {@link MarkupText#getText()} * on this instance will return the same string as {@link Entry#getMsgEscaped()}. * @since 1.568 */ public void annotate(Run<?, ?> build, Entry change, MarkupText text) { if (build instanceof AbstractBuild && Util.isOverridden( ChangeLogAnnotator.class, getClass(), "annotate", AbstractBuild.class, Entry.class, MarkupText.class)) { annotate((AbstractBuild) build, change, text); } else { throw new AbstractMethodError("You must override the newer overload of annotate"); } }
/** * Find a build to copy artifacts from. * * @param job Source project * @param runList If non-null, ordered set of builds to examine for a match * @param env Environment for build that is copying artifacts * @return Build to use, or null if no appropriate build was found */ public Run<?, ?> getBuild(Job<?, ?> job, List<Run<?, ?>> runList, EnvVars env) { // Backward compatibility: // If this BuildSelector overrides the old API just call it (even though it'll ignore runList) if (Util.isOverridden(BuildSelector.class, getClass(), "getBuild", Job.class, EnvVars.class)) return getBuild(job, env); if (runList != null) { for (Run<?, ?> run : runList) if (isSelectable(run, env)) return run; } else { for (Run<?, ?> run = job.getLastCompletedBuild(); run != null; run = run.getPreviousCompletedBuild()) if (isSelectable(run, env)) return run; } return null; }