GigaSpaces XAP 9.7.2 API

org.openspaces.grid.gsm.machines.plugins.discovered
Class DiscoveredMachineProvisioningBean

java.lang.Object
  extended by org.openspaces.grid.gsm.machines.plugins.discovered.DiscoveredMachineProvisioningBean
All Implemented Interfaces:
Bean, ElasticProcessingUnitMachineIsolationAware, ElasticGridServiceAgentProvisioningProgressEventListenerAware, ElasticMachineProvisioningProgressChangedEventListenerAware, NonBlockingElasticMachineProvisioning, ElasticMachineProvisioningSpaceAware, ProcessingUnitAware

public class DiscoveredMachineProvisioningBean
extends Object
implements NonBlockingElasticMachineProvisioning, Bean, ProcessingUnitAware


Constructor Summary
DiscoveredMachineProvisioningBean()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a bean factory after it has set all bean properties.
 FutureCleanupCloudResources cleanupCloudResources(long duration, TimeUnit unit)
          Cleanup all cloud resources.
 void destroy()
          Invoked by a bean factory on destruction of a singleton.
 ElasticMachineProvisioningConfig getConfig()
           
 FutureGridServiceAgents getDiscoveredMachinesAsync(long duration, TimeUnit unit)
           
 Map<String,String> getProperties()
           
 boolean isStartMachineSupported()
           
 FutureMachineFailure[] onMachinesFailureAsync(FailedGridServiceAgent[] failedAgents, long duration, TimeUnit unit)
          Perform the required actions following an unexpected machine failure.
 void setAdmin(Admin admin)
          Set the Admin instance to be used by this Bean.
 void setElasticGridServiceAgentProvisioningProgressEventListener(ElasticGridServiceAgentProvisioningProgressChangedEventListener agentEventListener)
           
 void setElasticMachineProvisioningProgressChangedEventListener(ElasticMachineProvisioningProgressChangedEventListener machineEventListener)
           
 void setElasticMachineProvisioningSpace(GigaSpace space)
           
 void setElasticProcessingUnitMachineIsolation(ElasticProcessingUnitMachineIsolation isolation)
           
 void setProcessingUnit(ProcessingUnit pu)
           
 void setProcessingUnitSchema(org.openspaces.admin.internal.pu.elastic.ProcessingUnitSchemaConfig schemaConfig)
           
 void setProperties(Map<String,String> properties)
          The bean properties supplied using a client side bean configuration object, or by plain String key-value pairs.
 FutureGridServiceAgent[] startMachinesAsync(CapacityRequirements capacityRequirements, ExactZonesConfig zones, FailedGridServiceAgent[] failedAgents, long duration, TimeUnit unit)
          Starts a new machine with a new grid service agent with the specified grid service agent zones.
 FutureStoppedMachine stopMachineAsync(GridServiceAgent agent, long duration, TimeUnit unit)
          Shuts down the grid service agent and the machine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveredMachineProvisioningBean

public DiscoveredMachineProvisioningBean()
Method Detail

setAdmin

public void setAdmin(Admin admin)
Description copied from interface: Bean
Set the Admin instance to be used by this Bean.

Specified by:
setAdmin in interface Bean
Parameters:
admin - an Admin instance.

setProperties

public void setProperties(Map<String,String> properties)
Description copied from interface: Bean
The bean properties supplied using a client side bean configuration object, or by plain String key-value pairs.

Specified by:
setProperties in interface Bean
Parameters:
properties - properties to configure this bean.

getProperties

public Map<String,String> getProperties()
Specified by:
getProperties in interface Bean
Returns:
properties used to configure this bean.

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Description copied from interface: Bean
Invoked by a bean factory after it has set all bean properties. This method allows the bean instance to perform non-blocking initialization, which is only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface Bean
Throws:
Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.
See Also:
BeanConfigurationException, BeanInitializationException

destroy

public void destroy()
             throws Exception
Description copied from interface: Bean
Invoked by a bean factory on destruction of a singleton.

Specified by:
destroy in interface Bean
Throws:
Exception - in case of shutdown errors. Exceptions will get logged but not re-thrown to allow other beans to release their resources too.
See Also:
BeanConfigException

setProcessingUnit

public void setProcessingUnit(ProcessingUnit pu)
Specified by:
setProcessingUnit in interface ProcessingUnitAware

setProcessingUnitSchema

public void setProcessingUnitSchema(org.openspaces.admin.internal.pu.elastic.ProcessingUnitSchemaConfig schemaConfig)
Specified by:
setProcessingUnitSchema in interface ProcessingUnitAware

getDiscoveredMachinesAsync

public FutureGridServiceAgents getDiscoveredMachinesAsync(long duration,
                                                          TimeUnit unit)
Specified by:
getDiscoveredMachinesAsync in interface NonBlockingElasticMachineProvisioning
Parameters:
duration - - the maximum duration after which a TimeoutException is raised.
unit - - the time unit for the duration
Returns:
a future array of grid service agents that reside in the data center (or cloud region) defined in ElasticMachineProvisioningConfig The caller then filters the result using the criteria defined in ElasticMachineProvisioningConfig.getGridServiceAgentZones() , ElasticMachineProvisioningConfig.isGridServiceAgentZoneMandatory() and ElasticMachineProvisioningConfig.isDedicatedManagementMachines() so it is not mandatory for the implementation to do so.

getConfig

public ElasticMachineProvisioningConfig getConfig()
Specified by:
getConfig in interface NonBlockingElasticMachineProvisioning
Returns:
the configuration used by this object

isStartMachineSupported

public boolean isStartMachineSupported()
Specified by:
isStartMachineSupported in interface NonBlockingElasticMachineProvisioning
Returns:
true if this object supports starting and stopping of machines. False indicates that #startMachinesAsync(CapacityRequirements, long, TimeUnit) and NonBlockingElasticMachineProvisioning.stopMachineAsync(GridServiceAgent, long, TimeUnit) raise UnsupportedOperationException

stopMachineAsync

public FutureStoppedMachine stopMachineAsync(GridServiceAgent agent,
                                             long duration,
                                             TimeUnit unit)
Description copied from interface: NonBlockingElasticMachineProvisioning
Shuts down the grid service agent and the machine. The implementation should be able to close machines that it has not started, but rather an older instance of this object started perhaps with different configuration. This method is non blocking and is idempotent.

Specified by:
stopMachineAsync in interface NonBlockingElasticMachineProvisioning
Returns:

setElasticProcessingUnitMachineIsolation

public void setElasticProcessingUnitMachineIsolation(ElasticProcessingUnitMachineIsolation isolation)
Specified by:
setElasticProcessingUnitMachineIsolation in interface ElasticProcessingUnitMachineIsolationAware

startMachinesAsync

public FutureGridServiceAgent[] startMachinesAsync(CapacityRequirements capacityRequirements,
                                                   ExactZonesConfig zones,
                                                   FailedGridServiceAgent[] failedAgents,
                                                   long duration,
                                                   TimeUnit unit)
Description copied from interface: NonBlockingElasticMachineProvisioning
Starts a new machine with a new grid service agent with the specified grid service agent zones. This method is non blocking and returns a future object with the new grid service agent.

Specified by:
startMachinesAsync in interface NonBlockingElasticMachineProvisioning
Parameters:
capacityRequirements - - total capacity of new machines
zones - - the agent zones.
failedAgents - - list of agents that require recovery
duration - - the maximum duration after which a TimeoutException is raised.
unit - - the time unit for the duration.
Returns:
the grid service agent futures

setElasticMachineProvisioningProgressChangedEventListener

public void setElasticMachineProvisioningProgressChangedEventListener(ElasticMachineProvisioningProgressChangedEventListener machineEventListener)
Specified by:
setElasticMachineProvisioningProgressChangedEventListener in interface ElasticMachineProvisioningProgressChangedEventListenerAware

setElasticGridServiceAgentProvisioningProgressEventListener

public void setElasticGridServiceAgentProvisioningProgressEventListener(ElasticGridServiceAgentProvisioningProgressChangedEventListener agentEventListener)
Specified by:
setElasticGridServiceAgentProvisioningProgressEventListener in interface ElasticGridServiceAgentProvisioningProgressEventListenerAware

cleanupCloudResources

public FutureCleanupCloudResources cleanupCloudResources(long duration,
                                                         TimeUnit unit)
Description copied from interface: NonBlockingElasticMachineProvisioning
Cleanup all cloud resources. This method is called once after the processing unit has undeployed and all machines have been stopped.

Specified by:
cleanupCloudResources in interface NonBlockingElasticMachineProvisioning

onMachinesFailureAsync

public FutureMachineFailure[] onMachinesFailureAsync(FailedGridServiceAgent[] failedAgents,
                                                     long duration,
                                                     TimeUnit unit)
Description copied from interface: NonBlockingElasticMachineProvisioning
Perform the required actions following an unexpected machine failure. E.g. handle machine related resources (e.g. floating IPs, attached storage). This method is called once during failover, just before starting a new machine. The method is non blocking and returns an array of future objects, one for each failed machine that was handled.

Specified by:
onMachinesFailureAsync in interface NonBlockingElasticMachineProvisioning
Parameters:
failedAgents - - list of agents that require recovery
Returns:
an array of future objects, one for each failed machine that was handled

setElasticMachineProvisioningSpace

public void setElasticMachineProvisioningSpace(GigaSpace space)
Specified by:
setElasticMachineProvisioningSpace in interface ElasticMachineProvisioningSpaceAware

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.