Package jenkins.model
Interface IComputer
- All Superinterfaces:
AccessControlled,IconSpec,ModelObject,Named
- All Known Implementing Classes:
AbstractCloudComputer,Computer,Hudson.MasterComputer,Jenkins.MasterComputer,SlaveComputer
@Restricted(org.kohsuke.accmod.restrictions.Beta.class)
public interface IComputer
extends AccessControlled, IconSpec, ModelObject, Named
Interface for computer-like objects meant to be passed to
t:executors tag.- Since:
- 2.480
-
Method Summary
Modifier and TypeMethodDescriptionFuture<?> connect(boolean forceReconnect) Attempts to connect this computer.intReturns the number ofIExecutors that are doing some work right now.intReturns the current size of the executor pool for this computer.intdefault ACLgetACL()Obtains the ACL associated with this object.List<? extends IDisplayExecutor> Used to render the list of executors.default StringgetIcon()Returns the icon for this computer.default StringReturns the alternative text for the computer icon.default StringReturns the class name that will be used to look up the icon.default StringIf the computer was offline (either temporarily or not), this method will return the cause as a string (without user info).default StringgetUrl()default booleanbooleanReturnstrueif the computer is accepting tasks.default booleanIndicates whether the agent is actually connected to the controller.booleanbooleanbooleanReturns whether the agent is offline for scheduling new tasks.booleanisOnline()Indicates whether the agent can accept a new task when it becomes idle.Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.model.ModelObject
getDisplayName
-
Method Details
-
getDisplayExecutors
Used to render the list of executors.- Returns:
- a snapshot of the executor display information
-
isOffline
boolean isOffline()Returns whether the agent is offline for scheduling new tasks. Even iftrue, the agent may still be connected to the controller and executing a task, but is considered offline for scheduling.- Returns:
trueif the agent is offline;falseif online.- See Also:
-
isAcceptingTasks
boolean isAcceptingTasks()Returnstrueif the computer is accepting tasks. Needed to allow agents programmatic suspension of task scheduling that does not overlap with being offline.- Returns:
trueif the computer is accepting tasks- See Also:
-
getUrl
- Returns:
- the URL where to reach specifically this computer, relative to Jenkins URL.
-
hasOfflineCause
default boolean hasOfflineCause()- Returns:
trueif 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
If the computer was offline (either temporarily or not), this method will return the cause as a string (without user info).hasOfflineCause() == trueimplies 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
Returns the icon for this computer.It is both the recommended and default implementation to serve different icons based on
isOffline()- See Also:
-
getIconAltText
Returns the alternative text for the computer icon. -
getTooltip
-
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 throughIconSet.addIcon(Icon)- Specified by:
getIconClassNamein interfaceIconSpec- Returns:
- The Icon class specification e.g. 'icon-notepad'.
- See Also:
-
countBusy
int countBusy()Returns the number ofIExecutors that are doing some work right now. -
countExecutors
int countExecutors()Returns the current size of the executor pool for this computer. -
isOnline
boolean isOnline()Indicates whether the agent can accept a new task when it becomes idle.falsedoes not necessarily mean the agent is disconnected.- Returns:
trueif the agent is online.- See Also:
-
isConnected
default boolean isConnected()Indicates whether the agent is actually connected to the controller.- Returns:
trueif the agent is connected to the controller.
-
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
falsefrom this, because the launch process needs to be initiated from the agent side.
-
connect
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
Futurerepresenting 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 asIComputeris connected it can be disconnected by some other threads.)
-
getACL
Description copied from interface:AccessControlledObtains the ACL associated with this object.- Specified by:
getACLin interfaceAccessControlled- Returns:
- never null.
-