Package jenkins.model

Interface IComputer

All Superinterfaces:
AccessControlled
All Known Implementing Classes:
AbstractCloudComputer, Computer, Hudson.MasterComputer, Jenkins.MasterComputer, SlaveComputer

@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public interface IComputer extends AccessControlled
Interface for computer-like objects meant to be passed to t:executors tag.
Since:
2.480
  • Method Details

    • getName

      @NonNull String getName()
    • getDisplayExecutors

      @NonNull List<? extends IDisplayExecutor> getDisplayExecutors()
      Used to render the list of executors.
      Returns:
      a snapshot of the executor display information
    • isOffline

      boolean isOffline()
      Returns:
      true if the node is offline. false if it is online.
    • getDisplayName

      @NonNull String getDisplayName()
      Returns:
      the node name for UI purposes.
    • isAcceptingTasks

      boolean isAcceptingTasks()
      Returns true if the computer is accepting tasks. Needed to allow agents programmatic suspension of task scheduling that does not overlap with being offline.
      Returns:
      true if the computer is accepting tasks
      See Also:
    • getUrl

      @NonNull String getUrl()
      Returns:
      the URL where to reach specifically this computer, relative to Jenkins URL.
    • hasOfflineCause

      default boolean hasOfflineCause()
      Returns:
      true if this computer has a defined offline cause, @{code false} otherwise.
    • getOfflineCause

      IOfflineCause getOfflineCause()
      Returns:
      the offline cause if the computer is offline.
      Since:
      2.483
    • getOfflineCauseReason

      @NonNull default String getOfflineCauseReason()
      If the computer was offline (either temporarily or not), this method will return the cause as a string (without user info).

      hasOfflineCause() == true implies this must be nonempty.

      Returns:
      empty string if the system was put offline without given a cause.
    • isConnecting

      boolean isConnecting()
      Returns:
      true if the node is currently connecting to the Jenkins controller.
    • getIcon

      default String getIcon()
      Returns the icon for this computer.

      It is both the recommended and default implementation to serve different icons based on isOffline()

      See Also:
    • getIconAltText

      default String getIconAltText()
      Returns the alternative text for the computer icon.
    • getTooltip

      default String getTooltip()
    • getIconClassName

      default String getIconClassName()
      Returns the class name that will be used to look up the icon.

      This class name will be added as a class tag to the html img tags where the icon should show up followed by a size specifier given by Icon.toNormalizedIconSizeClass(String) The conversion of class tag to src tag is registered through IconSet.addIcon(Icon)

      See Also:
    • countBusy

      int countBusy()
      Returns the number of IExecutors that are doing some work right now.
    • countExecutors

      int countExecutors()
      Returns the current size of the executor pool for this computer.
    • isOnline

      boolean isOnline()
      Returns:
      true if the computer is online.
    • countIdle

      int countIdle()
      Returns:
      the number of IExecutors that are idle right now.
    • isLaunchSupported

      boolean isLaunchSupported()
      Returns:
      true if this computer can be launched by Jenkins proactively and automatically.

      For example, inbound agents return false from this, because the launch process needs to be initiated from the agent side.

    • connect

      Future<?> connect(boolean forceReconnect)
      Attempts to connect this computer.
      Parameters:
      forceReconnect - If true and a connect activity is already in progress, it will be cancelled and the new one will be started. If false, and a connect activity is already in progress, this method will do nothing and just return the pending connection operation.
      Returns:
      A Future representing pending completion of the task. The 'completion' includes both a successful completion and a non-successful completion (such distinction typically doesn't make much sense because as soon as IComputer is connected it can be disconnected by some other threads.)
    • getACL

      @NonNull default ACL getACL()
      Description copied from interface: AccessControlled
      Obtains the ACL associated with this object.
      Specified by:
      getACL in interface AccessControlled
      Returns:
      never null.