Package hudson.slaves
Class RetentionStrategy<T extends Computer>
- All Implemented Interfaces:
ExtensionPoint
,Describable<RetentionStrategy<?>>
- Direct Known Subclasses:
CloudRetentionStrategy
,CloudSlaveRetentionStrategy
,RetentionStrategy.Always
,RetentionStrategy.Demand
,SimpleScheduledRetentionStrategy
public abstract class RetentionStrategy<T extends Computer>
extends AbstractDescribableImpl<RetentionStrategy<?>>
implements ExtensionPoint
Controls when to take
Computer
offline, bring it back online, or even to destroy it.- Author:
- Stephen Connolly, Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
RetentionStrategy
that tries to keep the node online all the time.static class
RetentionStrategy
that tries to keep the node offline when not in use.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final RetentionStrategy.Always
Convenient singleton instance, since thisRetentionStrategy
is stateless.static final DescriptorList<RetentionStrategy<?>>
Deprecated.static final RetentionStrategy<Computer>
Dummy instance that doesn't do any attempt to retention. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DescriptorExtensionList<RetentionStrategy<?>,
Descriptor<RetentionStrategy<?>>> all()
Returns all the registeredRetentionStrategy
descriptors.abstract long
This method will be called periodically to allow this strategy to decide what to do with its owning agent.boolean
Returnstrue
if the computer is accepting tasks.boolean
This method is called to determine whether manual launching of the agent is allowed right now.void
Called when a newComputer
object is introduced (such as when Hudson started, or when a new agent is added).Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Field Details
-
LIST
All registeredRetentionStrategy
implementations. -
NOOP
Dummy instance that doesn't do any attempt to retention. -
INSTANCE
Convenient singleton instance, since thisRetentionStrategy
is stateless.
-
-
Constructor Details
-
RetentionStrategy
public RetentionStrategy()
-
-
Method Details
-
check
This method will be called periodically to allow this strategy to decide what to do with its owning agent.- Parameters:
c
-Computer
for which this strategy is assigned. This computer may be online or offline. This object also exposes a bunch of properties that the callee can use to decide what action to take.- Returns:
- The number of minutes after which the strategy would like to be checked again. The strategy may be rechecked earlier or later than this!
-
isManualLaunchAllowed
This method is called to determine whether manual launching of the agent is allowed right now.- Parameters:
c
-Computer
for which this strategy is assigned. This computer may be online or offline. This object also exposes a bunch of properties that the callee can use to decide if manual launching is allowed.- Returns:
true
if manual launching of the agent is allowed right now.
-
isAcceptingTasks
Returnstrue
if the computer is accepting tasks. Needed to allow retention strategies programmatic suspension of task scheduling that in preparation for going offline. Called byComputer.isAcceptingTasks()
- Parameters:
c
- the computer.- Returns:
true
if the computer is accepting tasks- Since:
- 1.586
- See Also:
-
start
Called when a newComputer
object is introduced (such as when Hudson started, or when a new agent is added).The default implementation of this method delegates to
check(Computer)
, but this allowsRetentionStrategy
to distinguish the first time invocation from the rest.- Parameters:
c
- Computer instance- Since:
- 1.275
-
all
Returns all the registeredRetentionStrategy
descriptors.
-
all()
for read access, andExtension
for registration.