@Deprecated
public class MachinePool
extends java.lang.Object
Machine instances themselves are persisted and rescanned as new instances of this class are created. Claims however are specific to this instance of the class, i.e. not persisted.
This class is believed to be thread-safe. Refreshes to the remote detected machines are synchronized on the pool instance. Details of detected and claimed machines are also synchronized on the pool instance. (If it is necessary to claim machines whilst the pool is being rescanned, we can investigate a more sophisticated threading model. Access to some fields is clearly independent and uses a tighter synchonization strategy, e.g. templates. Synchronization of fields within a synch block on the class instance is permitted, but not the other way round, and synching on multiple fields is also not permitted.)
Callers wishing to guarantee results of e.g. ensureUnclaimed remaining available can synchronize on this class for the duration that they wish to have that guarantee (at the cost, of course, of any other threads being able to access this pool).
If underlying provisioning/destroying operations fail, the pool currently may be in an unknown state, currently. If more robustness is needed this can be added.
Constructor and Description |
---|
MachinePool(org.jclouds.compute.ComputeService computeService)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addToBlacklist(MachineSet newToBlacklist)
Deprecated.
|
MachineSet |
all()
Deprecated.
all machines matching any templates
|
MachineSet |
all(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata>... ops)
Deprecated.
returns all machines matching the given criteria (may be claimed)
|
MachineSet |
all(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> criterion)
Deprecated.
returns all machines matching the given criteria (may be claimed)
|
MachineSet |
claim(int count,
ReusableMachineTemplate t)
Deprecated.
claims the indicated number of machines with the indicated spec, creating if necessary
|
MachineSet |
claim(MachineSet set)
Deprecated.
claims the indicated set of machines;
throws exception if cannot all be claimed;
returns the set passed in if successful
|
MachineSet |
create(int count,
ReusableMachineTemplate template)
Deprecated.
creates the given number of machines of the indicated template
|
int |
destroy(MachineSet set)
Deprecated.
|
MachineSet |
ensureExists(int count,
ReusableMachineTemplate template)
Deprecated.
creates machines if necessary so that this spec exists (may already be claimed however);
returns a set of all matching machines, of size at least count (but possibly some are already claimed).
|
MachineSet |
ensureExists(ReusableMachineTemplate template)
Deprecated.
creates machines if necessary so that this spec exists (may already be claimed however)
returns a set of all matching machines, guaranteed non-empty
(but possibly some are already claimed)
|
MachineSet |
ensureUnclaimed(int count,
ReusableMachineTemplate template)
Deprecated.
creates machines if necessary so that this spec can subsequently be claimed;
returns a set of at least count unclaimed machines
|
MachineSet |
ensureUnclaimed(ReusableMachineTemplate template)
Deprecated.
creates machines if necessary so that this spec can subsequently be claimed;
returns all such unclaimed machines, guaranteed to be non-empty.
|
java.lang.String |
getPoolName()
Deprecated.
pool name is used as a group/label by jclouds, for convenience only;
it has no special properties for detecting matching instances
(use explicit tags on the templates, for that).
|
java.util.List<ReusableMachineTemplate> |
getTemplates()
Deprecated.
|
java.util.Set<ReusableMachineTemplate> |
getTemplatesMatchingInstance(org.jclouds.compute.domain.NodeMetadata nm)
Deprecated.
|
void |
refresh()
Deprecated.
refreshes the pool of machines from the server (finding all instances matching the registered templates)
|
void |
setBlacklist(MachineSet newBlacklist)
Deprecated.
replaces the blacklist set; callers should generally perform a refresh()
afterwards, to trigger re-detection of blacklisted machines
|
void |
setPoolName(java.lang.String poolName)
Deprecated.
|
int |
unclaim(MachineSet set)
Deprecated.
|
MachineSet |
unclaimed()
Deprecated.
machines matching any templates which have not been claimed
|
MachineSet |
unclaimed(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata>... criteria)
Deprecated.
returns unclaimed machines matching the given criteria
|
MachineSet |
unclaimed(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> criterion)
Deprecated.
returns unclaimed machines matching the given criteria
|
public MachinePool(org.jclouds.compute.ComputeService computeService)
public void setPoolName(java.lang.String poolName)
public java.lang.String getPoolName()
public void refresh()
public java.util.List<ReusableMachineTemplate> getTemplates()
public MachineSet all()
public MachineSet unclaimed()
public MachineSet all(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> criterion)
public MachineSet all(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata>... ops)
public MachineSet unclaimed(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> criterion)
public MachineSet unclaimed(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata>... criteria)
public MachineSet ensureExists(ReusableMachineTemplate template)
public void addToBlacklist(MachineSet newToBlacklist)
public void setBlacklist(MachineSet newBlacklist)
public MachineSet ensureExists(int count, ReusableMachineTemplate template)
public MachineSet ensureUnclaimed(ReusableMachineTemplate template)
public MachineSet ensureUnclaimed(int count, ReusableMachineTemplate template)
public java.util.Set<ReusableMachineTemplate> getTemplatesMatchingInstance(org.jclouds.compute.domain.NodeMetadata nm)
public MachineSet create(int count, ReusableMachineTemplate template)
public MachineSet claim(int count, ReusableMachineTemplate t)
public MachineSet claim(MachineSet set)
public int unclaim(MachineSet set)
public int destroy(MachineSet set)