org.jclouds.nodepool.internal
Class EagerNodePoolComputeServiceAdapter

java.lang.Object
  extended by org.jclouds.nodepool.internal.BaseNodePoolComputeServiceAdapter
      extended by org.jclouds.nodepool.internal.EagerNodePoolComputeServiceAdapter
All Implemented Interfaces:
ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>, JCloudsNativeComputeServiceAdapter, NodePoolComputeServiceAdapter

@Singleton
public class EagerNodePoolComputeServiceAdapter
extends BaseNodePoolComputeServiceAdapter

An eager NodePoolComputeService. Eagerly builds and maintains a pool of nodes. It's only "started" after min nodes are allocated and available.

Author:
David Alves

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jclouds.compute.JCloudsNativeComputeServiceAdapter
JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials
 
Nested classes/interfaces inherited from interface org.jclouds.compute.ComputeServiceAdapter
ComputeServiceAdapter.NodeAndInitialCredentials<N>
 
Field Summary
protected  Logger logger
           
 
Fields inherited from class org.jclouds.nodepool.internal.BaseNodePoolComputeServiceAdapter
backendComputeService, backendTemplate, initialCredentialsBuilder, metadataStore, poolGroupName
 
Constructor Summary
EagerNodePoolComputeServiceAdapter(com.google.common.base.Supplier<ComputeService> backendComputeService, com.google.common.base.Supplier<Template> backendTemplate, String poolGroupPrefix, int maxSize, int minSize, boolean removeDestroyed, NodeMetadataStore storage, String poolNodeAdminAccess, AdminAccess.Configuration configuration)
           
 
Method Summary
 JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials createNodeWithGroupEncodedIntoName(String group, String name, Template template)
          ComputeService.createNodesInGroup(String, int, Template) generates the parameters passed into this method such that each node in the set has a unique name.
 int currentSize()
           
 void destroyNode(String id)
          
 int idleNodes()
           
 int maxNodes()
           
 int minNodes()
           
 void startEagerPool()
           
 int usedNodes()
           
 
Methods inherited from class org.jclouds.nodepool.internal.BaseNodePoolComputeServiceAdapter
addToPool, destroyPool, getBackendComputeServiceContext, getBackendNodes, getImage, getNode, getPoolGroupName, listHardwareProfiles, listImages, listLocations, listNodes, rebootNode, resumeNode, suspendNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

@Named(value="jclouds.compute")
protected Logger logger
Constructor Detail

EagerNodePoolComputeServiceAdapter

@Inject
public EagerNodePoolComputeServiceAdapter(com.google.common.base.Supplier<ComputeService> backendComputeService,
                                                 com.google.common.base.Supplier<Template> backendTemplate,
                                                 @Named(value="jclouds.nodepool.backend-group")
                                                 String poolGroupPrefix,
                                                 @Named(value="jclouds.nodepool.max-size")
                                                 int maxSize,
                                                 @Named(value="jclouds.nodepool.min-size")
                                                 int minSize,
                                                 @Named(value="jclouds.nodepool.remove-destroyed")
                                                 boolean removeDestroyed,
                                                 NodeMetadataStore storage,
                                                 @Named(value="jclouds.nodepool.admin-access")
                                                 String poolNodeAdminAccess,
                                                 AdminAccess.Configuration configuration)
Method Detail

startEagerPool

@PostConstruct
public void startEagerPool()

createNodeWithGroupEncodedIntoName

public JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials createNodeWithGroupEncodedIntoName(String group,
                                                                                                        String name,
                                                                                                        Template template)
Description copied from interface: ComputeServiceAdapter
ComputeService.createNodesInGroup(String, int, Template) generates the parameters passed into this method such that each node in the set has a unique name.

note

It is intentional to return the library native node object, as generic type N. If you are not using library-native objects (such as libvirt Domain) use JCloudsNativeComputeServiceAdapter instead.

note

Your responsibility is to create a node with the underlying library and return after storing its credentials in the supplied map corresponding to credentialStore

Parameters:
group - used to aggregate nodes with identical configuration
name - unique supplied name for the node, which has the group encoded into it.
template - includes imageId, locationId, and hardwareId used to resume the instance.
Returns:
library-native representation of a node. TODO: return typed exception on createNodeFailure
See Also:
ComputeService.createNodesInGroup(String, int, Template)

destroyNode

public void destroyNode(String id)
Description copied from interface: JCloudsNativeComputeServiceAdapter


currentSize

public int currentSize()

idleNodes

public int idleNodes()

maxNodes

public int maxNodes()

minNodes

public int minNodes()

usedNodes

public int usedNodes()


Copyright © 2009-2012 jclouds. All Rights Reserved.