public class CloudSlaveRetentionStrategy<T extends Computer> extends RetentionStrategy<T>
RetentionStrategy for slaves provisioned from Cloud.
If a slave is idle for 10 mins, this retention strategy will remove the slave. This can be used as-is for
a Node provisioned by cloud to implement the auto-scaling semantics, it can be subtyped to tweak
the behavior, or it can be used as an example.
TODO CloudRetentionStrategy seems to be a better implementation.
RetentionStrategy.Always, RetentionStrategy.DemandExtensionPoint.LegacyInstancesAreScopedToHudson| Modifier and Type | Field and Description |
|---|---|
static long |
TIMEOUT |
INSTANCE, LIST, NOOP| Constructor and Description |
|---|
CloudSlaveRetentionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
long |
check(T c)
This method will be called periodically to allow this strategy to decide what to do with it's owning slave.
|
protected long |
checkCycle()
When do we check again next time?
|
protected long |
getIdleMaxTime()
If the computer has been idle longer than this time, we'll kill the slave.
|
protected boolean |
isIdleForTooLong(T c)
Has this computer been idle for too long?
|
protected void |
kill(Node n)
Remove the node.
|
all, isAcceptingTasks, isManualLaunchAllowed, startgetDescriptorpublic long check(T c)
RetentionStrategycheck in class RetentionStrategy<T extends Computer>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.protected void kill(Node n) throws IOException
To actually deallocate the resource tied to this Node, implement Computer.onRemoved().
IOExceptionprotected long checkCycle()
protected boolean isIdleForTooLong(T c)
protected long getIdleMaxTime()
Copyright © 2019. All rights reserved.