public abstract class RetentionStrategy<T extends Computer> extends AbstractDescribableImpl<RetentionStrategy<?>> implements ExtensionPoint
Computer
offline, bring it back online, or even to destroy it.Modifier and Type | Class and Description |
---|---|
static class |
RetentionStrategy.Always
RetentionStrategy that tries to keep the node online all the time. |
static class |
RetentionStrategy.Demand
RetentionStrategy that tries to keep the node offline when not in use. |
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
static RetentionStrategy.Always |
INSTANCE
Convenient singleton instance, since this
RetentionStrategy is stateless. |
static DescriptorList<RetentionStrategy<?>> |
LIST
|
static RetentionStrategy<Computer> |
NOOP
Dummy instance that doesn't do any attempt to retention.
|
Constructor and Description |
---|
RetentionStrategy() |
Modifier and Type | Method and Description |
---|---|
static DescriptorExtensionList<RetentionStrategy<?>,Descriptor<RetentionStrategy<?>>> |
all()
Returns all the registered
RetentionStrategy descriptors. |
abstract long |
check(T c)
This method will be called periodically to allow this strategy to decide what to do with its owning agent.
|
boolean |
isAcceptingTasks(T c)
Returns
true if the computer is accepting tasks. |
boolean |
isManualLaunchAllowed(T c)
This method is called to determine whether manual launching of the agent is allowed right now.
|
void |
start(T c)
Called when a new
Computer object is introduced (such as when Hudson started, or when
a new agent is added). |
getDescriptor
@Deprecated public static final DescriptorList<RetentionStrategy<?>> LIST
RetentionStrategy
implementations.public static final RetentionStrategy<Computer> NOOP
public static final RetentionStrategy.Always INSTANCE
RetentionStrategy
is stateless.public abstract long check(@Nonnull T c)
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.public boolean isManualLaunchAllowed(T c)
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.true
if manual launching of the agent is allowed right now.public boolean isAcceptingTasks(T c)
true
if the computer is accepting tasks. Needed to allow retention strategies programmatic
suspension of task scheduling that in preparation for going offline. Called by
Computer.isAcceptingTasks()
c
- the computer.true
if the computer is accepting tasksComputer.isAcceptingTasks()
public void start(@Nonnull T c)
Computer
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 allows RetentionStrategy
to distinguish the first time invocation from the rest.
c
- Computer instancepublic static DescriptorExtensionList<RetentionStrategy<?>,Descriptor<RetentionStrategy<?>>> all()
RetentionStrategy
descriptors.Copyright © 2004–2019. All rights reserved.