public class CloudSlaveRetentionStrategy<T extends Computer> extends RetentionStrategy<T>
RetentionStrategy
for 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 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.Demand
ExtensionPoint.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 its owning agent.
|
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 agent.
|
protected boolean |
isIdleForTooLong(T c)
Has this computer been idle for too long?
|
protected void |
kill(Node n)
Remove the node.
|
all, isAcceptingTasks, isManualLaunchAllowed, start
getDescriptor
public long check(T c)
RetentionStrategy
check
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()
.
IOException
protected long checkCycle()
protected boolean isIdleForTooLong(T c)
protected long getIdleMaxTime()
Copyright © 2004–2021. All rights reserved.