public class CloudSlaveRetentionStrategy<T extends Computer> extends RetentionStrategy<T>Default convenience implementation of
RetentionStrategyfor agents provisioned from
Cloud. If an agent is idle for 10 mins, this retention strategy will remove the agent. This can be used as-is for a
Nodeprovisioned by cloud to implement the auto-scaling semantics, it can be subtyped to tweak the behavior, or it can be used as an example.
CloudRetentionStrategyseems to be a better implementation.
- Kohsuke Kawaguchi
Constructors Constructor Description
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
check(T c)This method will be called periodically to allow this strategy to decide what to do with its owning agent.
checkCycle()When do we check again next time?
getIdleMaxTime()If the computer has been idle longer than this time, we'll kill the agent.
isIdleForTooLong(T c)Has this computer been idle for too long?
kill(Node n)Remove the node.
Methods inherited from class hudson.slaves.RetentionStrategy
all, isAcceptingTasks, isManualLaunchAllowed, start
public long check(T c)Description copied from class:
RetentionStrategyThis method will be called periodically to allow this strategy to decide what to do with its owning agent.
- Specified by:
RetentionStrategy<T extends Computer>
Computerfor 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.
- The number of minutes after which the strategy would like to be checked again. The strategy may be rechecked earlier or later than this!
protected void kill(Node n) throws IOExceptionRemove the node.
protected long checkCycle()When do we check again next time?
protected boolean isIdleForTooLong(T c)Has this computer been idle for too long?
protected long getIdleMaxTime()If the computer has been idle longer than this time, we'll kill the agent.