org.openspaces.grid.gsm.machines.plugins
Class NonBlockingElasticMachineProvisioningAdapter
java.lang.Object
org.openspaces.grid.gsm.machines.plugins.NonBlockingElasticMachineProvisioningAdapter
- All Implemented Interfaces:
- ElasticProcessingUnitMachineIsolationAware, ElasticGridServiceAgentProvisioningProgressEventListenerAware, ElasticMachineProvisioningProgressChangedEventListenerAware, NonBlockingElasticMachineProvisioning, ElasticMachineProvisioningSpaceAware
public class NonBlockingElasticMachineProvisioningAdapter
- extends Object
- implements NonBlockingElasticMachineProvisioning
An adapter that wraps an ElasticMachineProvisioning
and exposes a NonBlockingElasticMachineProvisioning
- Author:
- itaif
- See Also:
NonBlockingElasticMachineProvisioning
,
ElasticMachineProvisioning
Method Summary |
FutureCleanupCloudResources |
cleanupCloudResources(long duration,
TimeUnit unit)
Cleanup all cloud resources. |
ElasticMachineProvisioningConfig |
getConfig()
|
FutureGridServiceAgents |
getDiscoveredMachinesAsync(long duration,
TimeUnit unit)
|
ElasticMachineProvisioning |
getElasticMachineProvisioning()
|
boolean |
isStartMachineSupported()
|
FutureMachineFailure[] |
onMachinesFailureAsync(FailedGridServiceAgent[] failedAgents,
long duration,
TimeUnit unit)
Perform the required actions following an unexpected machine failure. |
void |
setElasticGridServiceAgentProvisioningProgressEventListener(ElasticGridServiceAgentProvisioningProgressChangedEventListener agentEventListener)
|
void |
setElasticMachineProvisioningProgressChangedEventListener(ElasticMachineProvisioningProgressChangedEventListener machineEventListener)
|
void |
setElasticMachineProvisioningSpace(GigaSpace space)
|
void |
setElasticProcessingUnitMachineIsolation(ElasticProcessingUnitMachineIsolation isolation)
|
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 |
NonBlockingElasticMachineProvisioningAdapter
public NonBlockingElasticMachineProvisioningAdapter(ElasticMachineProvisioning machineProvisioning,
ExecutorService executorService,
ScheduledThreadPoolExecutor scheduledExecutorService)
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 machineszones
- - the agent zones.failedAgents
- - list of agents that require recoveryduration
- - the maximum duration after which a TimeoutException is raised.unit
- - the time unit for the duration.
- Returns:
- the grid service agent futures
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:
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
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
setElasticProcessingUnitMachineIsolation
public void setElasticProcessingUnitMachineIsolation(ElasticProcessingUnitMachineIsolation isolation)
- Specified by:
setElasticProcessingUnitMachineIsolation
in interface ElasticProcessingUnitMachineIsolationAware
setElasticMachineProvisioningProgressChangedEventListener
public void setElasticMachineProvisioningProgressChangedEventListener(ElasticMachineProvisioningProgressChangedEventListener machineEventListener)
- Specified by:
setElasticMachineProvisioningProgressChangedEventListener
in interface ElasticMachineProvisioningProgressChangedEventListenerAware
setElasticGridServiceAgentProvisioningProgressEventListener
public void setElasticGridServiceAgentProvisioningProgressEventListener(ElasticGridServiceAgentProvisioningProgressChangedEventListener agentEventListener)
- Specified by:
setElasticGridServiceAgentProvisioningProgressEventListener
in interface ElasticGridServiceAgentProvisioningProgressEventListenerAware
getElasticMachineProvisioning
public ElasticMachineProvisioning getElasticMachineProvisioning()
setElasticMachineProvisioningSpace
public void setElasticMachineProvisioningSpace(GigaSpace space)
- Specified by:
setElasticMachineProvisioningSpace
in interface ElasticMachineProvisioningSpaceAware
Copyright © GigaSpaces.