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.int
Returns the number ofIExecutor
s that are doing some work right now.int
Returns the current size of the executor pool for this computer.int
default ACL
getACL()
Obtains the ACL associated with this object.List
<? extends IDisplayExecutor> Used to render the list of executors.default String
getIcon()
Returns the icon for this computer.default String
Returns the alternative text for the computer icon.default String
Returns the class name that will be used to look up the icon.default String
If the computer was offline (either temporarily or not), this method will return the cause as a string (without user info).default String
getUrl()
default boolean
boolean
Returnstrue
if the computer is accepting tasks.default boolean
Indicates whether the agent is actually connected to the controller.boolean
boolean
boolean
Returns whether the agent is offline for scheduling new tasks.boolean
isOnline()
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, hasPermission2
Methods 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:
true
if the agent is offline;false
if online.- See Also:
-
isAcceptingTasks
boolean isAcceptingTasks()Returnstrue
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
- 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
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
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:
getIconClassName
in interfaceIconSpec
- Returns:
- The Icon class specification e.g. 'icon-notepad'.
- See Also:
-
countBusy
int countBusy()Returns the number ofIExecutor
s 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.false
does not necessarily mean the agent is disconnected.- Returns:
true
if the agent is online.- See Also:
-
isConnected
default boolean isConnected()Indicates whether the agent is actually connected to the controller.- Returns:
true
if the agent is connected to the controller.
-
countIdle
int countIdle()- Returns:
- the number of
IExecutor
s 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
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 asIComputer
is connected it can be disconnected by some other threads.)
-
getACL
Description copied from interface:AccessControlled
Obtains the ACL associated with this object.- Specified by:
getACL
in interfaceAccessControlled
- Returns:
- never null.
-