hudson.slaves
Class RetentionStrategy<T extends Computer>

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<RetentionStrategy<?>>
      extended by hudson.slaves.RetentionStrategy<T>
All Implemented Interfaces:
ExtensionPoint, Describable<RetentionStrategy<?>>
Direct Known Subclasses:
CloudRetentionStrategy, 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
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.
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static RetentionStrategy.Always INSTANCE
          Convenient singleton instance, since this RetentionStrategy is stateless.
static DescriptorList<RetentionStrategy<?>> LIST
          Deprecated. as of 1.286 Use all() for read access, and Extension for registration.
static RetentionStrategy<Computer> NOOP
          Dummy instance that doesn't do any attempt to retention.
 
Constructor Summary
RetentionStrategy()
           
 
Method Summary
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 it's owning slave.
 boolean isManualLaunchAllowed(T c)
          This method is called to determine whether manual launching of the slave is allowed at this point in time.
 void start(T c)
          Called when a new Computer object is introduced (such as when Hudson started, or when a new slave is added.)
 
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIST

public static final DescriptorList<RetentionStrategy<?>> LIST
Deprecated. as of 1.286 Use all() for read access, and Extension for registration.
All registered RetentionStrategy implementations.


NOOP

public static final RetentionStrategy<Computer> NOOP
Dummy instance that doesn't do any attempt to retention.


INSTANCE

public static final RetentionStrategy.Always INSTANCE
Convenient singleton instance, since this RetentionStrategy is stateless.

Constructor Detail

RetentionStrategy

public RetentionStrategy()
Method Detail

check

public abstract long check(T c)
This method will be called periodically to allow this strategy to decide what to do with it's owning slave.

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 that this!

isManualLaunchAllowed

public boolean isManualLaunchAllowed(T c)
This method is called to determine whether manual launching of the slave is allowed at this point in time.

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 at this time.
Returns:
true if manual launching of the slave is allowed at this point in time.

start

public void start(T c)
Called when a new Computer object is introduced (such as when Hudson started, or when a new slave 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.

Since:
1.275

all

public static DescriptorExtensionList<RetentionStrategy<?>,Descriptor<RetentionStrategy<?>>> all()
Returns all the registered RetentionStrategy descriptors.



Copyright © 2004-2013 Hudson. All Rights Reserved.