GigaSpaces XAP 10.0.1 API

org.openspaces.admin.pu
Interface ProcessingUnit

All Superinterfaces:
AdminAware, Iterable<ProcessingUnitInstance>, StatisticsMonitor

public interface ProcessingUnit
extends Iterable<ProcessingUnitInstance>, AdminAware, StatisticsMonitor

A processing unit holds one or more ProcessingUnitInstances.

Author:
kimchy, itaif

Field Summary
 
Fields inherited from interface org.openspaces.admin.StatisticsMonitor
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL
 
Method Summary
 void addLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
          Adds a ProcessingUnitInstanceLifecycleEventListener.
 boolean canDecrementInstance()
          Returns true if this processing unit allows to decrement instances on it.
 boolean canIncrementInstance()
          Returns true if this processing unit allows to increment instances on it.
 void decrementInstance()
          Removes a randomly chosen instance from the processing unit, and decrements the number of instances.
 Application getApplication()
           
 GridServiceManager getBackupGridServiceManager(String gridServiceManagerUID)
          Returns the backup GSM matching the provided UID.
 BackupGridServiceManagerChangedEventManager getBackupGridServiceManagerChanged()
          Returns an event manager allowing to listen for BackupGridServiceManagerChangedEvents.
 GridServiceManager[] getBackupGridServiceManagers()
          Returns the backup GSMs for the processing unit.
 BeanLevelProperties getBeanLevelProperties()
          Return the deploy time properties of the processing unit.
 ProcessingUnitDependencies<ProcessingUnitDependency> getDependencies()
           
 ProcessingUnitInstance[] getInstances()
          Returns the processing unit instances currently discovered.
 GridServiceManager getManagingGridServiceManager()
          Returns the managing (primary) GSM for the processing unit.
 ManagingGridServiceManagerChangedEventManager getManagingGridServiceManagerChanged()
          Returns an event manger allowing to listen for ManagingGridServiceManagerChangedEvents.
 int getMaxInstancesPerMachine()
          Returns the number of instances of this processing unit that can run within a Machine.
 int getMaxInstancesPerVM()
          Returns the number of instances of this processing unit that can run within a VM.
 Map<String,Integer> getMaxInstancesPerZone()
          Returns a map containing the zone name and the maximum number of instances for that zone.
 String getName()
          Returns the name of the processing unit.
 int getNumberOfBackups()
          Returns the number of backups (if the topology is a backup one) per instance, as defined in the processing unit's SLA.
 int getNumberOfInstances()
          Deprecated. - since 9.5.0 - For retrieving planned number of stateless pu instances use getPlannedNumberOfInstances(). For retrieving planned number of primary space instances use #getPlannedNumberOfParitions(). For retrieving planned number of all space instances (primary+backup) use getPlannedNumberOfInstances() Returns the number of required instances as defined in the processing unit's SLA. If there are backups, it will only return the number of primary instances and not the number of backup. To get the total number of instances please use the method getTotalNumberOfInstances(). Note that this method does not count the number of running instances, but rather the number of planned instances for the processing unit. To count the number of active processing unit instances please use the method getInstances().
 ProcessingUnitPartition getPartition(int partitionId)
          Returns a processing unit partition based on the specified partition id.
 ProcessingUnitPartition[] getPartitions()
          Returns the processing unit partitions of this processing unit.
 int getPlannedNumberOfInstances()
           
 int getPlannedNumberOfPartitions()
          Returns the number of primary instances excluding backup instances.
 ProcessingUnitInstanceAddedEventManager getProcessingUnitInstanceAdded()
          Returns an event manager allowing to register ProcessingUnitInstanceAddedEventListeners.
 ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventManager getProcessingUnitInstanceMemberAliveIndicatorStatusChanged()
          Returns an event manager allowing to register ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventListeners.
 ProcessingUnitInstanceProvisionStatusChangedEventManager getProcessingUnitInstanceProvisionStatusChanged()
          Returns an event manager allowing to register ProcessingUnitInstanceProvisionStatusChangedEventListeners.
 ProcessingUnitInstanceRemovedEventManager getProcessingUnitInstanceRemoved()
          Returns an event manager allowing to register ProcessingUnitInstanceRemovedEventListeners.
 ProcessingUnitInstanceStatisticsChangedEventManager getProcessingUnitInstanceStatisticsChanged()
          Returns a processing unit instance statistics change event manger allowing to register for events of ProcessingUnitInstanceStatisticsChangedEvent.
 ProcessingUnits getProcessingUnits()
          Returns the handle to all the different processing units.
 ProcessingUnitStatusChangedEventManager getProcessingUnitStatusChanged()
          Returns an event manager allowing to listen for ProcessingUnitStatusChangedEvents.
 RequiredZonesConfig getRequiredContainerZones()
           
 String[] getRequiredZones()
          Deprecated. 
 Space getSpace()
          Returns the (first) embedded space within a processing unit.
 ProcessingUnitSpaceCorrelatedEventManager getSpaceCorrelated()
          Returns an event manager allowing to listen for ProcessingUnitSpaceCorrelatedEvents.
 Space[] getSpaces()
          Returns all the embedded spaces within a processing unit.
 DeploymentStatus getStatus()
          Returns the deployment status of the processing unit.
 int getTotalNumberOfInstances()
          Deprecated. - since 9.6.0 - please use getPlannedNumberOfInstances() } Returns the total required number of instances as defined in the processing SLA. If there are no backups, will returngetNumberOfInstances(). If there are backups, will return getNumberOfInstances() * (getNumberOfBackups() + 1) Note that this method does not count the number of running instances, but rather the total number of planned instances for the processing unit. To count the number of active processing unit instances please use the method getInstances().
 ProcessingUnitType getType()
          Returns the type of processing unit: stateless, stateful, mirror, web.
 void incrementInstance()
          Increments the number of processing unit instances.
 boolean isManaged()
          Returns true if there is a managing GSM for it.
 void removeLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
          Removes a ProcessingUnitInstanceLifecycleEventListener.
 void scale(ScaleStrategyConfig strategyConfig)
          Modifies the processing unit scalability strategy.
 void scaleAndWait(ScaleStrategyConfig strategyConfig)
          Modifies the processing unit scalability strategy and waits until scale is complete This method is only available if the processing unit deployment is elastic
 boolean scaleAndWait(ScaleStrategyConfig strategyConfig, long timeout, TimeUnit timeUnit)
          Modifies the processing unit scalability strategy and waits until scale is complete This method is only available if the processing unit deployment is elastic
 void undeploy()
           
 void undeployAndWait()
          Un-deploys the processing unit and waits until all instances have been undeployed.
 boolean undeployAndWait(long timeout, TimeUnit timeunit)
          Undeploys the processing unit and waits until all instances have been undeployed.
 boolean waitFor(int numberOfProcessingUnitInstances)
          Waits till at least the provided number of Processing Unit Instances are up.
 boolean waitFor(int numberOfProcessingUnitInstances, long timeout, TimeUnit timeUnit)
          Waits till at least the provided number of Processing Unit Instances are up for the specified timeout.
 GridServiceManager waitForManaged()
          Waits till there is a managing GridServiceManager for the processing unit.
 GridServiceManager waitForManaged(long timeout, TimeUnit timeUnit)
          Waits till there is a managing GridServiceManager for the processing unit for the specified timeout.
 Space waitForSpace()
          Waits till an embedded Space is correlated with the processing unit.
 Space waitForSpace(long timeout, TimeUnit timeUnit)
          Waits till an embedded Space is correlated with the processing unit for the specified timeout.
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.openspaces.admin.AdminAware
getAdmin
 
Methods inherited from interface org.openspaces.admin.StatisticsMonitor
isMonitoring, setStatisticsHistorySize, setStatisticsInterval, startStatisticsMonitor, stopStatisticsMonitor
 

Method Detail

getProcessingUnits

ProcessingUnits getProcessingUnits()
Returns the handle to all the different processing units.


getName

String getName()
Returns the name of the processing unit.


getNumberOfInstances

@Deprecated
int getNumberOfInstances()
Deprecated. - since 9.5.0 - For retrieving planned number of stateless pu instances use getPlannedNumberOfInstances(). For retrieving planned number of primary space instances use #getPlannedNumberOfParitions(). For retrieving planned number of all space instances (primary+backup) use getPlannedNumberOfInstances() Returns the number of required instances as defined in the processing unit's SLA. If there are backups, it will only return the number of primary instances and not the number of backup. To get the total number of instances please use the method getTotalNumberOfInstances(). Note that this method does not count the number of running instances, but rather the number of planned instances for the processing unit. To count the number of active processing unit instances please use the method getInstances().


getPlannedNumberOfPartitions

int getPlannedNumberOfPartitions()
Returns the number of primary instances excluding backup instances. Note that this method does not count the number of running instances, but rather the number of planned primary instances for the processing unit. To count the number of active processing unit partitions please use the method getPartitions().

Since:
9.6

getPlannedNumberOfInstances

int getPlannedNumberOfInstances()
Returns:
the number of required instances as defined in the processing unit's SLA. If there are backups, it will only return the number of primary instances and not the number of backup. To get the total number of instances please use the method getTotalNumberOfInstances(). Note that this method does not count the number of running instances, but rather the number of planned instances for the processing unit. To count the number of active processing unit instances please use the method getInstances(). If the processing unit is elastic return value may reflect updated planned number of instances based on scaling rules.
Since:
9.5.0

getNumberOfBackups

int getNumberOfBackups()
Returns the number of backups (if the topology is a backup one) per instance, as defined in the processing unit's SLA. Note that this method does not return he number of running backup instances, but rather the number of planned backup instances per primary.


getTotalNumberOfInstances

@Deprecated
int getTotalNumberOfInstances()
Deprecated. - since 9.6.0 - please use getPlannedNumberOfInstances() } Returns the total required number of instances as defined in the processing SLA. If there are no backups, will returngetNumberOfInstances(). If there are backups, will return getNumberOfInstances() * (getNumberOfBackups() + 1) Note that this method does not count the number of running instances, but rather the total number of planned instances for the processing unit. To count the number of active processing unit instances please use the method getInstances().


getMaxInstancesPerVM

int getMaxInstancesPerVM()
Returns the number of instances of this processing unit that can run within a VM.

In case of a partitioned with backup topology, it applies on a per partition level (meaning that a primary and backup will not run on the same VM).

In case of a non backup based topology, it applies on the number of instances of the whole processing unit that can run on the same VM).


getMaxInstancesPerMachine

int getMaxInstancesPerMachine()
Returns the number of instances of this processing unit that can run within a Machine.

In case of a partitioned with backup topology, it applies on a per partition level (meaning that a primary and backup will not run on the same Machine).

In case of a non backup based topology, it applies on the number of instances of the whole processing unit that can run on the same Machine).


getMaxInstancesPerZone

Map<String,Integer> getMaxInstancesPerZone()
Returns a map containing the zone name and the maximum number of instances for that zone.


getRequiredZones

@Deprecated
String[] getRequiredZones()
Deprecated. 

Returns the list of zones this processing units are required to run on. If there is more than one zone, the processing unit can run on either of the zones. This method is deprecated in favor of getRequiredContainerZones()


getRequiredContainerZones

RequiredZonesConfig getRequiredContainerZones()
Returns:
the @{link GridServiceContainer} zones that can satisfy this processing unit. For example: boolean gscMatch = pu.getRequiredContainerZones().isStatisfiedBy(gsc.getExactZones());

getStatus

DeploymentStatus getStatus()
Returns the deployment status of the processing unit.


getBeanLevelProperties

BeanLevelProperties getBeanLevelProperties()
Return the deploy time properties of the processing unit.


getType

ProcessingUnitType getType()
Returns the type of processing unit: stateless, stateful, mirror, web.

Since:
8.0.3

waitFor

boolean waitFor(int numberOfProcessingUnitInstances)
Waits till at least the provided number of Processing Unit Instances are up.


waitFor

boolean waitFor(int numberOfProcessingUnitInstances,
                long timeout,
                TimeUnit timeUnit)
Waits till at least the provided number of Processing Unit Instances are up for the specified timeout.


waitForSpace

Space waitForSpace()
Waits till an embedded Space is correlated with the processing unit.


waitForSpace

Space waitForSpace(long timeout,
                   TimeUnit timeUnit)
Waits till an embedded Space is correlated with the processing unit for the specified timeout.


waitForManaged

GridServiceManager waitForManaged()
Waits till there is a managing GridServiceManager for the processing unit.


waitForManaged

GridServiceManager waitForManaged(long timeout,
                                  TimeUnit timeUnit)
Waits till there is a managing GridServiceManager for the processing unit for the specified timeout.


canIncrementInstance

boolean canIncrementInstance()
Returns true if this processing unit allows to increment instances on it.


canDecrementInstance

boolean canDecrementInstance()
Returns true if this processing unit allows to decrement instances on it.


incrementInstance

void incrementInstance()
Increments the number of processing unit instances. Does not apply for partitioned nor replicated topologies.


decrementInstance

void decrementInstance()
Removes a randomly chosen instance from the processing unit, and decrements the number of instances. For finer control use ProcessingUnitInstance.decrement() instead. Does not apply for partitioned nor replicated topologies.


isManaged

boolean isManaged()
Returns true if there is a managing GSM for it.


getManagingGridServiceManager

GridServiceManager getManagingGridServiceManager()
Returns the managing (primary) GSM for the processing unit.


getBackupGridServiceManagers

GridServiceManager[] getBackupGridServiceManagers()
Returns the backup GSMs for the processing unit.


getBackupGridServiceManager

GridServiceManager getBackupGridServiceManager(String gridServiceManagerUID)
Returns the backup GSM matching the provided UID.


undeploy

void undeploy()
See Also:
undeployAndWait(), undeployAndWait(long, TimeUnit)

undeployAndWait

void undeployAndWait()
Un-deploys the processing unit and waits until all instances have been undeployed. In case of an Elastic processing unit, also waits for containers to shutdown.

The undeployment process will wait indefinitely and return when all processing units have undeployed.

Since:
8.0.5
See Also:
undeployAndWait(long, TimeUnit), undeploy()

undeployAndWait

boolean undeployAndWait(long timeout,
                        TimeUnit timeunit)
Undeploys the processing unit and waits until all instances have been undeployed. In case of an Elastic processing unit, it waits until all containers have been removed.

The undeployment process will wait for the given timeout and return when all processing units have undeployed or timeout expired.

Returns:
True if un-deploy completed successfully within the specified timeout. False if undeploy is still in progress.
Since:
8.0.5
See Also:
undeployAndWait(), undeploy()

getSpace

Space getSpace()
Returns the (first) embedded space within a processing unit. Returns null if no embedded space is defined within the processing unit or if no processing unit instance has been added to the processing unit.


getSpaces

Space[] getSpaces()
Returns all the embedded spaces within a processing unit. Returns an empty array if there are no embedded spaces defined within the processing unit, or none has been associated with the processing unit yet.


getInstances

ProcessingUnitInstance[] getInstances()
Returns the processing unit instances currently discovered.


getPartitions

ProcessingUnitPartition[] getPartitions()
Returns the processing unit partitions of this processing unit.


getPartition

ProcessingUnitPartition getPartition(int partitionId)
Returns a processing unit partition based on the specified partition id.


getProcessingUnitInstanceAdded

ProcessingUnitInstanceAddedEventManager getProcessingUnitInstanceAdded()
Returns an event manager allowing to register ProcessingUnitInstanceAddedEventListeners.


getProcessingUnitInstanceRemoved

ProcessingUnitInstanceRemovedEventManager getProcessingUnitInstanceRemoved()
Returns an event manager allowing to register ProcessingUnitInstanceRemovedEventListeners.


addLifecycleListener

void addLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
Adds a ProcessingUnitInstanceLifecycleEventListener.


removeLifecycleListener

void removeLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
Removes a ProcessingUnitInstanceLifecycleEventListener.


getManagingGridServiceManagerChanged

ManagingGridServiceManagerChangedEventManager getManagingGridServiceManagerChanged()
Returns an event manger allowing to listen for ManagingGridServiceManagerChangedEvents.


getBackupGridServiceManagerChanged

BackupGridServiceManagerChangedEventManager getBackupGridServiceManagerChanged()
Returns an event manager allowing to listen for BackupGridServiceManagerChangedEvents.


getProcessingUnitStatusChanged

ProcessingUnitStatusChangedEventManager getProcessingUnitStatusChanged()
Returns an event manager allowing to listen for ProcessingUnitStatusChangedEvents.


getSpaceCorrelated

ProcessingUnitSpaceCorrelatedEventManager getSpaceCorrelated()
Returns an event manager allowing to listen for ProcessingUnitSpaceCorrelatedEvents.


getProcessingUnitInstanceStatisticsChanged

ProcessingUnitInstanceStatisticsChangedEventManager getProcessingUnitInstanceStatisticsChanged()
Returns a processing unit instance statistics change event manger allowing to register for events of ProcessingUnitInstanceStatisticsChangedEvent.

Note, in order to receive events, the virtual machines need to be in a "statistics" monitored state.


getProcessingUnitInstanceProvisionStatusChanged

ProcessingUnitInstanceProvisionStatusChangedEventManager getProcessingUnitInstanceProvisionStatusChanged()
Returns an event manager allowing to register ProcessingUnitInstanceProvisionStatusChangedEventListeners.

Since:
8.0.6

getProcessingUnitInstanceMemberAliveIndicatorStatusChanged

ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventManager getProcessingUnitInstanceMemberAliveIndicatorStatusChanged()
Returns an event manager allowing to register ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventListeners.

Since:
8.0.6

scale

void scale(ScaleStrategyConfig strategyConfig)
Modifies the processing unit scalability strategy. This method is only available if the processing unit deployment is elastic

Parameters:
strategyConfig -
Since:
8.0
See Also:
scaleAndWait(ScaleStrategyConfig), scaleAndWait(ScaleStrategyConfig, long, TimeUnit)

scaleAndWait

void scaleAndWait(ScaleStrategyConfig strategyConfig)
Modifies the processing unit scalability strategy and waits until scale is complete This method is only available if the processing unit deployment is elastic

Parameters:
strategyConfig -
Since:
8.0.5
See Also:
scale(ScaleStrategyConfig)

scaleAndWait

boolean scaleAndWait(ScaleStrategyConfig strategyConfig,
                     long timeout,
                     TimeUnit timeUnit)
Modifies the processing unit scalability strategy and waits until scale is complete This method is only available if the processing unit deployment is elastic

Parameters:
strategyConfig -
Returns:
false if timeout occurred before scale operation has completed.
Since:
8.0.5
See Also:
scale(ScaleStrategyConfig)

getApplication

Application getApplication()
Returns:
the application that this processing unit is associated with or null if this processing unit is not part of an application
Since:
8.0.3

getDependencies

ProcessingUnitDependencies<ProcessingUnitDependency> getDependencies()
Returns:
the dependencies this processing unit has on other processing units.
Since:
8.0.6

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.