Interface ProcessingUnit
- All Superinterfaces:
AdminAware,Iterable<ProcessingUnitInstance>,StatisticsMonitor
- All Known Subinterfaces:
InternalProcessingUnit
- All Known Implementing Classes:
DefaultProcessingUnit
ProcessingUnitInstances.- Author:
- kimchy, itaif
-
Field Summary
Fields inherited from interface org.openspaces.admin.StatisticsMonitor
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener) booleanbooleanvoidRemoves a randomly chosen instance from the processing unit, and decrements the number of instances.getBackupGridServiceManager(String gridServiceManagerUID) intintgetName()intintDeprecated.getPartition(int partitionId) intFor stateful processing unit (primary+backup Space) will return the current planned number of instances (including backups).intFor stateful processing unit (primary+backup Space) will return the planned partition count - i.e.getProcessingUnitInstance(int instanceId, int backupId) String[]Deprecated.This method is deprecated in favor ofgetRequiredContainerZones()getSpace()Space[]intDeprecated.- since 9.6.0 - please usegetPlannedNumberOfInstances()getType()booleanhasSpace()Returns true if there are any embedded spaces, false otherwise.voidIncrements the number of processing unit instances.booleanbooleanquiesce(QuiesceRequest request) Requests a quiesce request from the GSM.voidRemoves aProcessingUnitInstanceLifecycleEventListener.voidsetLogLevel(String loggerName, String level) voidundeploy()voidUn-deploys the processing unit and waits until all instances have been undeployed.booleanundeployAndWait(long timeout, TimeUnit timeunit) Undeploy the processing unit and wait until all instances have been undeployed.undeployAsync(UndeployOptions options) voidunquiesce(QuiesceRequest request) Requests a unquiesce request from the GSM.booleanwaitFor(int numberOfProcessingUnitInstances) Waits till at least the provided number of Processing Unit Instances are up.booleanWaits till at least the provided number of Processing Unit Instances are up for the specified timeout.booleanwaitFor(QuiesceState desiredState) Same aswaitFor(com.gigaspaces.admin.quiesce.QuiesceState, long, java.util.concurrent.TimeUnit)but with endless timeoutbooleanwaitFor(QuiesceState desiredState, long timeout, TimeUnit timeUnit) Waits till there is a managingGridServiceManagerfor the processing unit.waitForManaged(long timeout, TimeUnit timeUnit) Waits till there is a managingGridServiceManagerfor the processing unit for the specified timeout.Waits till an embedded Space is correlated with the processing unit.waitForSpace(long timeout, TimeUnit timeUnit) Waits till an embedded Space is correlated with the processing unit for the specified timeout.Methods inherited from interface org.openspaces.admin.AdminAware
getAdminMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.openspaces.admin.StatisticsMonitor
isMonitoring, setStatisticsHistorySize, setStatisticsInterval, startStatisticsMonitor, stopStatisticsMonitor
-
Method Details
-
getProcessingUnits
ProcessingUnits getProcessingUnits()- Returns:
- Returns the handle to all the different processing units.
-
getName
String getName()- Returns:
- Returns the name of the processing unit.
-
getNumberOfInstances
Deprecated.- since 9.5.0 - please use the following alternatives: For retrieving planned number of partitions usegetPlannedNumberOfPartitions(). Otherwise usegetPlannedNumberOfInstances()for retrieving planned number of stateful (primary+backup Space instances) -or- stateless pu instances. 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 currently discovered running processing unit instances use the methodgetInstances().- Returns:
- 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.
-
getPlannedNumberOfPartitions
int getPlannedNumberOfPartitions()For stateful processing unit (primary+backup Space) will return the planned partition count - i.e. the number of planned primary instances (excluding backups). If called for a stateless processing unit, will return the planned number of 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 currently discovered running processing unit partitions use the methodgetPartitions().- Returns:
- Returns the number of planned primary instances excluding backup instances.
- Since:
- 9.6
-
getPlannedNumberOfInstances
int getPlannedNumberOfInstances()For stateful processing unit (primary+backup Space) will return the current planned number of instances (including backups). For stateless processing unit will return the number of current planned instances. The plan denoted by the initial SLA may change due to increments/decrements performed manually. Note that this method does not count the number of running instances, but rather the number of planned number of instances for the processing unit. To count the number of currently discovered running processing unit instances use the methodgetInstances().- Returns:
- Returns the number of required instances as defined in the processing unit's current SLA.
- Since:
- 9.5.0
-
getNumberOfBackups
int getNumberOfBackups()- Returns:
- 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 as defined by the initial SLA.
-
getTotalNumberOfInstances
Deprecated.- since 9.6.0 - please usegetPlannedNumberOfInstances()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 methodgetInstances().- Returns:
- Returns the total required number of instances as defined in the processing SLA. If
there are no backups, will return
getNumberOfInstances(). If there are backups, will returngetNumberOfInstances()* (getNumberOfBackups()+ 1)
-
getMaxInstancesPerVM
int getMaxInstancesPerVM()- Returns:
- 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:
- 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).
-
isRequiresIsolation
boolean isRequiresIsolation()- Returns:
- true if isolation is required per virtual machine. No processing unit instances can run on the same virtual machine. Default false.
- Since:
- 10.1.0
-
getMaxInstancesPerZone
- Returns:
- Returns a map containing the zone name and the maximum number of instances for that zone.
-
getRequiredZones
Deprecated.This method is deprecated in favor ofgetRequiredContainerZones()- Returns:
- 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.
-
getPrimaryZones
- Returns:
- Returns the preferred zones for primary instances.
- Since:
- 12.3.1
-
getRequiredContainerZones
RequiredZonesConfig getRequiredContainerZones()- Returns:
- the @{link GridServiceContainer} zones that can satisfy this processing unit. For example: boolean gscMatch = pu.getRequiredContainerZones().isSatisfiedBy(gsc.getExactZones());
-
getGridServiceContainers
GridServiceContainer[] getGridServiceContainers()- Returns:
- Returns the @{link GridServiceContainer}s this processing unit is deployed on.
- Since:
- 12.2
-
getStatus
DeploymentStatus getStatus()- Returns:
- Returns the deployment status of the processing unit.
-
getBeanLevelProperties
BeanLevelProperties getBeanLevelProperties()- Returns:
- Return the deploy time properties of the processing unit.
-
getType
ProcessingUnitType getType()- Returns:
- Returns the type of processing unit: stateless, stateful, mirror, web.
- Since:
- 8.0.3
-
setLogLevel
- Throws:
AdminException- Since:
- 15.8.0
-
waitFor
boolean waitFor(int numberOfProcessingUnitInstances) Waits till at least the provided number of Processing Unit Instances are up.- Returns:
trueif discovered the required number of instances within the default timeout andfalseif the waiting time elapsed before the discovery took place
-
waitFor
Waits till at least the provided number of Processing Unit Instances are up for the specified timeout.- Returns:
trueif discovered the required number of instances within the specified timeout andfalseif the waiting time elapsed before the discovery took place
-
waitForSpace
Space waitForSpace()Waits till an embedded Space is correlated with the processing unit.- Returns:
- Returns the embedded Space within a processing unit if the Space was correlated
within the default timeout; Otherwise
nullif the waiting time elapsed before correlation took place.
-
waitForSpace
Waits till an embedded Space is correlated with the processing unit for the specified timeout.- Returns:
- Returns the embedded Space within a processing unit if the Space was correlated
within the specified timeout; Otherwise
nullif the waiting time elapsed before correlation took place.
-
waitForManaged
GridServiceManager waitForManaged()Waits till there is a managingGridServiceManagerfor the processing unit.- Returns:
- Returns the managing (primary) GSM for the processing unit if GSM was discovered
within the default timeout; Otherwise
nullif the waiting time elapsed before discovery took place.
-
waitForManaged
Waits till there is a managingGridServiceManagerfor the processing unit for the specified timeout.- Returns:
- Returns the managing (primary) GSM for the processing unit if GSM was discovered
within the specified timeout; Otherwise
nullif the waiting time elapsed before discovery took place.
-
canIncrementInstance
boolean canIncrementInstance()- Returns:
- Returns
trueif this processing unit allows to increment instances on it.
-
canDecrementInstance
boolean canDecrementInstance()- Returns:
- Returns
trueif 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 useProcessingUnitInstance.decrement()instead. Does not apply for partitioned nor replicated topologies.- Since:
- 10.1.0 decrements planned instances before decrementing an actual instance
-
isManaged
boolean isManaged()- Returns:
- Returns
trueif there is a managing GSM for it.
-
getManagingGridServiceManager
GridServiceManager getManagingGridServiceManager()- Returns:
- Returns the managing (primary) GSM for the processing unit.
-
getBackupGridServiceManagers
GridServiceManager[] getBackupGridServiceManagers()- Returns:
- Returns the backup GSMs for the processing unit.
-
getBackupGridServiceManager
- Returns:
- Returns the backup GSM matching the provided UID.
-
undeploy
void undeploy() -
undeployAsync
CompletableFuture<?> undeployAsync()- Returns:
- A future which can be used to track completion
- Since:
- 15.5
-
undeployAsync
- Parameters:
options- determine the wanted drain behaviour before undeploy- Returns:
- A future which can be used to track completion
- Since:
- 16.0
- See Also:
-
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
Undeploy the processing unit and wait 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:
-
hasSpace
boolean hasSpace()Returns true if there are any embedded spaces, false otherwise.- Since:
- 15.5
-
getSpace
Space getSpace()- Returns:
- Returns the (first) embedded space within a processing unit. Returns
nullif 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:
- 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:
- Returns the processing unit instances currently discovered.
-
getPartitions
ProcessingUnitPartition[] getPartitions()- Returns:
- Returns the processing unit partitions of this processing unit.
-
getPartition
- Returns:
- Returns a processing unit partition based on the specified partition id.
-
getProcessingUnitInstanceAdded
ProcessingUnitInstanceAddedEventManager getProcessingUnitInstanceAdded()- Returns:
- Returns an event manager allowing to register
ProcessingUnitInstanceAddedEventListeners.
-
getProcessingUnitInstanceRemoved
ProcessingUnitInstanceRemovedEventManager getProcessingUnitInstanceRemoved()- Returns:
- Returns an event manager allowing to register
ProcessingUnitInstanceRemovedEventListeners.
-
getProcessingUnitInstance
- Returns:
- Returns a processing unit instance based on the specified instance id and backup id
-
addLifecycleListener
-
removeLifecycleListener
Removes aProcessingUnitInstanceLifecycleEventListener. -
getManagingGridServiceManagerChanged
ManagingGridServiceManagerChangedEventManager getManagingGridServiceManagerChanged()- Returns:
- Returns an event manger allowing to listen for
ManagingGridServiceManagerChangedEvents.
-
getBackupGridServiceManagerChanged
BackupGridServiceManagerChangedEventManager getBackupGridServiceManagerChanged()- Returns:
- Returns an event manager allowing to listen for
BackupGridServiceManagerChangedEvents.
-
getProcessingUnitStatusChanged
ProcessingUnitStatusChangedEventManager getProcessingUnitStatusChanged()- Returns:
- Returns an event manager allowing to listen for
ProcessingUnitStatusChangedEvents.
-
getProcessingUnitInstanceStatisticsChanged
ProcessingUnitInstanceStatisticsChangedEventManager getProcessingUnitInstanceStatisticsChanged()- Returns:
- 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:
- Returns an event manager allowing to register
ProcessingUnitInstanceProvisionStatusChangedEventListeners. - Since:
- 8.0.6
-
getProcessingUnitInstanceMemberAliveIndicatorStatusChanged
ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventManager getProcessingUnitInstanceMemberAliveIndicatorStatusChanged()- Returns:
- Returns an event manager allowing to register
ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventListeners. - Since:
- 8.0.6
-
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
-
quiesce
Requests a quiesce request from the GSM. If the request ended successfully (waitFor(com.gigaspaces.admin.quiesce.QuiesceState)returned true) all space instances and listeners will switch to quiesced mode. If the GSM rejects the request an exception with the rejection failure will be thrown. (precondition: the processing unit is intact)- Parameters:
request- with the quiesce description- Returns:
QuiesceRequestif the request was approved by the server
-
unquiesce
Requests a unquiesce request from the GSM. If the request ended successfully (waitFor(com.gigaspaces.admin.quiesce.QuiesceState)returned true) all space instances and listeners will switch to unquiesced mode. If the GSM rejects the request an exception with the rejection failure will be thrown. (precondition: the processing unit is intact)- Parameters:
request- with the quiesce description
-
waitFor
- Returns:
trueif the processing unit reached to desired as well as all instances in the requested timeout,falseotherwise.
-
waitFor
Same aswaitFor(com.gigaspaces.admin.quiesce.QuiesceState, long, java.util.concurrent.TimeUnit)but with endless timeout -
getQuiesceDetails
QuiesceDetails getQuiesceDetails()- Returns:
- the quiesce details of the processing unit -
QuiesceDetails
-
getArchiveName
String getArchiveName()- Returns:
- the archive(jar/war etc') the pu is running with
- Since:
- 12.1.0
-
getPlannedNumberOfPartitions().