public class DefaultProcessingUnit extends Object implements InternalProcessingUnit
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL| Constructor and Description |
|---|
DefaultProcessingUnit(InternalAdmin admin,
InternalProcessingUnits processingUnits,
com.gigaspaces.grid.gsm.PUDetails details,
BeanLevelProperties beanLevelProperties) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBackupGridServiceManager(GridServiceManager backupGridServiceManager) |
void |
addEmbeddedSpace(Space space) |
void |
addLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
|
void |
addManagingGridServiceManager(GridServiceManager gridServiceManager) |
void |
addProcessingUnitInstance(ProcessingUnitInstance processingUnitInstance) |
void |
addStatisticsCalculation(ProcessingUnitStatisticsId statisticsId)
Adds the specified statistics calculation
|
boolean |
canDecrementInstance() |
boolean |
canIncrementInstance() |
void |
decrementInstance()
Removes a randomly chosen instance from the processing unit, and decrements the number of
instances.
|
boolean |
decrementPlannedInstances()
Decrements a planned instance if the number of planned instances is less then the actual
instances to maintain.
|
boolean |
equals(Object o) |
Admin |
getAdmin()
Returns the
Admin associated with this element. |
Application |
getApplication() |
String |
getApplicationDependencies()
This method is used by the webui.
|
String |
getApplicationName() |
String |
getArchiveName() |
GridServiceManager |
getBackupGridServiceManager(String gridServiceManagerUID) |
BackupGridServiceManagerChangedEventManager |
getBackupGridServiceManagerChanged() |
GridServiceManager[] |
getBackupGridServiceManagers() |
BeanLevelProperties |
getBeanLevelProperties() |
String |
getClusterSchema() |
ProcessingUnitDependencies<ProcessingUnitDependency> |
getDependencies() |
Map<String,String> |
getElasticProperties() |
ExactZonesConfig |
getHostingGridServiceAgentZones(ProcessingUnitInstance processingUnitInstance)
return the exact zones of the agent that belongs to processing unit instance
|
ProcessingUnitInstance[] |
getInstances() |
GridServiceManager |
getManagingGridServiceManager() |
ManagingGridServiceManagerChangedEventManager |
getManagingGridServiceManagerChanged() |
int |
getMaxInstancesPerMachine() |
int |
getMaxInstancesPerVM() |
Map<String,Integer> |
getMaxInstancesPerZone() |
String |
getName() |
int |
getNumberOfBackups() |
int |
getNumberOfInstances()
Deprecated.
|
ProcessingUnitPartition |
getPartition(int partitionId) |
ProcessingUnitPartition[] |
getPartitions() |
int |
getPlannedNumberOfInstances()
For stateful processing unit (primary+backup Space) will return the current planned
number of instances (including backups).
|
int |
getPlannedNumberOfPartitions()
For stateful processing unit (primary+backup Space) will return the planned partition count -
i.e.
|
ProcessingUnitInstanceAddedEventManager |
getProcessingUnitInstanceAdded() |
ProcessingUnitInstance |
getProcessingUnitInstanceByUid(String uid)
returns the processing unit instance based on its uid (see
GridComponent.getUid()) |
ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventManager |
getProcessingUnitInstanceMemberAliveIndicatorStatusChanged() |
ProcessingUnitInstanceProvisionStatusChangedEventManager |
getProcessingUnitInstanceProvisionStatusChanged() |
ProcessingUnitInstanceRemovedEventManager |
getProcessingUnitInstanceRemoved() |
ProcessingUnitInstance[] |
getProcessingUnitInstances() |
ProcessingUnitInstanceStatisticsChangedEventManager |
getProcessingUnitInstanceStatisticsChanged() |
ProcessingUnits |
getProcessingUnits() |
ProcessingUnitStatusChangedEventManager |
getProcessingUnitStatusChanged() |
Map<String,InternalProvisionStatusHolder> |
getProvisionStatusPerInstance() |
QuiesceDetails |
getQuiesceDetails() |
RequiredZonesConfig |
getRequiredContainerZones() |
String[] |
getRequiredZones() |
ScaleStrategyConfig |
getScaleStrategyConfig()
Returns the current scale strategy config
|
String |
getSimpleName()
In the case of application name prefix just processing unit name will be returned.
|
Space |
getSpace() |
ProcessingUnitSpaceCorrelatedEventManager |
getSpaceCorrelated() |
Space[] |
getSpaces() |
ProcessingUnitStatistics |
getStatistics() |
Set<ProcessingUnitStatisticsId> |
getStatisticsCalculations() |
DeploymentStatus |
getStatus() |
int |
getTotalNumberOfInstances()
Deprecated.
|
ProcessingUnitType |
getType() |
int |
hashCode() |
void |
incrementInstance()
Increments the number of processing unit instances.
|
boolean |
isBackupGsmInSync() |
boolean |
isManaged() |
boolean |
isMonitoring()
Returns
true if statistics are now being monitored. |
boolean |
isRequiresIsolation() |
Iterator<ProcessingUnitInstance> |
iterator() |
void |
processProvisionEvent(org.jini.rio.monitor.ProvisionLifeCycleEvent provisionLifeCycleEvent) |
QuiesceResult |
quiesce(QuiesceRequest request)
Requests a quiesce request from the GSM.
|
void |
removeBackupGridServiceManager(String gsmUID) |
boolean |
removeEmbeddedSpace(Space space) |
void |
removeLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
Removes a
ProcessingUnitInstanceLifecycleEventListener. |
void |
removeProcessingUnitInstance(String uid) |
void |
removeStatisticsCalculation(ProcessingUnitStatisticsId statisticsId)
Removes the specified statistics calculation
|
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 |
setApplication(Application application) |
void |
setBackupGsmInSync(boolean backupGsmIsInSync) |
void |
setElasticProperties(Map<String,String> properties)
Deprecated.
|
void |
setManagingGridServiceManager(GridServiceManager gridServiceManager) |
void |
setNumberOfBackups(int numberOfBackups) |
void |
setNumberOfInstances(int numberOfInstances) |
void |
setStatisticsHistorySize(int historySize)
Sets the history size of number of statistics stored.
|
void |
setStatisticsInterval(long interval,
TimeUnit timeUnit)
Sets the statistics interval, automatically updating the monitoring scheduled tasks if
monitoring is enabled.
|
boolean |
setStatus(int statusCode) |
void |
startStatisticsMonitor()
Starts the statistics monitor, starting a scheduled monitor that polls for statistics.
|
void |
stopStatisticsMonitor()
Stops the statistics monitor.
|
void |
undeploy() |
void |
undeployAndWait()
Un-deploys the processing unit and waits until all instances have been undeployed.
|
boolean |
undeployAndWait(long timeout,
TimeUnit timeUnit)
Undeploy the processing unit and wait until all instances have been undeployed.
|
void |
unquiesce(QuiesceRequest request)
Requests a unquiesce request from the GSM.
|
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.
|
boolean |
waitFor(QuiesceState desiredState)
Same as
ProcessingUnit.waitFor(com.gigaspaces.admin.quiesce.QuiesceState, long,
java.util.concurrent.TimeUnit) but with endless timeout |
boolean |
waitFor(QuiesceState desiredState,
long timeout,
TimeUnit timeUnit) |
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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic DefaultProcessingUnit(InternalAdmin admin, InternalProcessingUnits processingUnits, com.gigaspaces.grid.gsm.PUDetails details, BeanLevelProperties beanLevelProperties)
public ProcessingUnits getProcessingUnits()
getProcessingUnits in interface ProcessingUnitpublic Admin getAdmin()
AdminAwareAdmin associated with this element.getAdmin in interface AdminAwarepublic String getName()
getName in interface ProcessingUnitpublic BeanLevelProperties getBeanLevelProperties()
getBeanLevelProperties in interface ProcessingUnitpublic ProcessingUnitType getType()
getType in interface ProcessingUnitpublic ManagingGridServiceManagerChangedEventManager getManagingGridServiceManagerChanged()
getManagingGridServiceManagerChanged in interface ProcessingUnitManagingGridServiceManagerChangedEvents.public BackupGridServiceManagerChangedEventManager getBackupGridServiceManagerChanged()
getBackupGridServiceManagerChanged in interface ProcessingUnitBackupGridServiceManagerChangedEvents.public Space getSpace()
getSpace in interface ProcessingUnitnull if no embedded space is defined within the processing unit or if no
processing unit instance has been added to the processing unit.public Space[] getSpaces()
getSpaces in interface ProcessingUnitpublic void addEmbeddedSpace(Space space)
addEmbeddedSpace in interface InternalProcessingUnitpublic boolean removeEmbeddedSpace(Space space)
removeEmbeddedSpace in interface InternalProcessingUnitpublic Map<String,String> getElasticProperties()
getElasticProperties in interface InternalProcessingUnitpublic ProcessingUnitStatusChangedEventManager getProcessingUnitStatusChanged()
getProcessingUnitStatusChanged in interface ProcessingUnitProcessingUnitStatusChangedEvents.public ProcessingUnitInstanceAddedEventManager getProcessingUnitInstanceAdded()
getProcessingUnitInstanceAdded in interface ProcessingUnitProcessingUnitInstanceAddedEventListeners.public ProcessingUnitInstanceRemovedEventManager getProcessingUnitInstanceRemoved()
getProcessingUnitInstanceRemoved in interface ProcessingUnitProcessingUnitInstanceRemovedEventListeners.public ProcessingUnitSpaceCorrelatedEventManager getSpaceCorrelated()
getSpaceCorrelated in interface ProcessingUnitProcessingUnitSpaceCorrelatedEvents.public void addLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
ProcessingUnitaddLifecycleListener in interface ProcessingUnitpublic void removeLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
ProcessingUnitProcessingUnitInstanceLifecycleEventListener.removeLifecycleListener in interface ProcessingUnit@Deprecated public int getNumberOfInstances()
getNumberOfInstances in interface ProcessingUnitpublic int getPlannedNumberOfPartitions()
ProcessingUnitProcessingUnit.getPartitions().getPlannedNumberOfPartitions in interface ProcessingUnitpublic int getPlannedNumberOfInstances()
ProcessingUnitProcessingUnit.getInstances().getPlannedNumberOfInstances in interface ProcessingUnitpublic void setNumberOfInstances(int numberOfInstances)
setNumberOfInstances in interface InternalProcessingUnitpublic int getNumberOfBackups()
getNumberOfBackups in interface ProcessingUnitpublic void setNumberOfBackups(int numberOfBackups)
setNumberOfBackups in interface InternalProcessingUnit@Deprecated public int getTotalNumberOfInstances()
getTotalNumberOfInstances in interface ProcessingUnitProcessingUnit.getNumberOfInstances(). If there are backups, will
return ProcessingUnit.getNumberOfInstances() * (ProcessingUnit.getNumberOfBackups() + 1)public int getMaxInstancesPerVM()
getMaxInstancesPerVM in interface ProcessingUnitIn 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).
public boolean isRequiresIsolation()
isRequiresIsolation in interface ProcessingUnitpublic int getMaxInstancesPerMachine()
getMaxInstancesPerMachine in interface ProcessingUnitIn 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).
public String getClusterSchema()
getClusterSchema in interface InternalProcessingUnitpublic Map<String,Integer> getMaxInstancesPerZone()
getMaxInstancesPerZone in interface ProcessingUnitpublic String[] getRequiredZones()
getRequiredZones in interface ProcessingUnitpublic DeploymentStatus getStatus()
getStatus in interface ProcessingUnitpublic boolean waitFor(int numberOfProcessingUnitInstances)
ProcessingUnitwaitFor in interface ProcessingUnittrue if discovered the required number of instances within the default
timeout and false if the waiting time elapsed before the discovery took placepublic boolean waitFor(int numberOfProcessingUnitInstances,
long timeout,
TimeUnit timeUnit)
ProcessingUnitwaitFor in interface ProcessingUnittrue if discovered the required number of instances within the specified
timeout and false if the waiting time elapsed before the discovery took placepublic Space waitForSpace()
ProcessingUnitwaitForSpace in interface ProcessingUnitnull if the waiting time elapsed before
correlation took place.public Space waitForSpace(long timeout, TimeUnit timeUnit)
ProcessingUnitwaitForSpace in interface ProcessingUnitnull if the waiting time elapsed before
correlation took place.public GridServiceManager waitForManaged()
ProcessingUnitGridServiceManager for the
processing unit.waitForManaged in interface ProcessingUnitnull if the waiting time elapsed before
discovery took place.public GridServiceManager waitForManaged(long timeout, TimeUnit timeUnit)
ProcessingUnitGridServiceManager for the
processing unit for the specified timeout.waitForManaged in interface ProcessingUnitnull if the waiting time elapsed before
discovery took place.public boolean canIncrementInstance()
canIncrementInstance in interface ProcessingUnittrue if this processing unit allows to increment instances on
it.public boolean canDecrementInstance()
canDecrementInstance in interface ProcessingUnittrue if this processing unit allows to decrement instances on
it.public void incrementInstance()
ProcessingUnitincrementInstance in interface ProcessingUnitpublic void decrementInstance()
ProcessingUnitProcessingUnitInstance.decrement() instead. Does not
apply for partitioned nor replicated topologies.decrementInstance in interface ProcessingUnitpublic GridServiceManager getManagingGridServiceManager()
getManagingGridServiceManager in interface ProcessingUnitpublic GridServiceManager[] getBackupGridServiceManagers()
getBackupGridServiceManagers in interface ProcessingUnitpublic boolean isManaged()
isManaged in interface ProcessingUnittrue if there is a managing GSM for it.public GridServiceManager getBackupGridServiceManager(String gridServiceManagerUID)
getBackupGridServiceManager in interface ProcessingUnitpublic boolean undeployAndWait(long timeout,
TimeUnit timeUnit)
ProcessingUnitThe undeployment process will wait for the given timeout and return when all processing units have undeployed or timeout expired.
undeployAndWait in interface ProcessingUnitProcessingUnit.undeployAndWait(),
ProcessingUnit.undeploy()public void undeployAndWait()
ProcessingUnitThe undeployment process will wait indefinitely and return when all processing units have undeployed.
undeployAndWait in interface ProcessingUnitProcessingUnit.undeployAndWait(long, TimeUnit),
ProcessingUnit.undeploy()public void undeploy()
undeploy in interface ProcessingUnitProcessingUnit.undeployAndWait(),
ProcessingUnit.undeployAndWait(long, TimeUnit)public void setManagingGridServiceManager(GridServiceManager gridServiceManager)
setManagingGridServiceManager in interface InternalProcessingUnitpublic void addManagingGridServiceManager(GridServiceManager gridServiceManager)
addManagingGridServiceManager in interface InternalProcessingUnitpublic void addBackupGridServiceManager(GridServiceManager backupGridServiceManager)
addBackupGridServiceManager in interface InternalProcessingUnitpublic void removeBackupGridServiceManager(String gsmUID)
removeBackupGridServiceManager in interface InternalProcessingUnitpublic boolean setStatus(int statusCode)
setStatus in interface InternalProcessingUnitpublic Iterator<ProcessingUnitInstance> iterator()
iterator in interface Iterable<ProcessingUnitInstance>public ProcessingUnitInstance[] getInstances()
getInstances in interface ProcessingUnitpublic ProcessingUnitInstance[] getProcessingUnitInstances()
getProcessingUnitInstances in interface InternalProcessingUnitInstancesAwarepublic ProcessingUnitPartition[] getPartitions()
getPartitions in interface ProcessingUnitpublic ProcessingUnitPartition getPartition(int partitionId)
getPartition in interface ProcessingUnitpublic void addProcessingUnitInstance(ProcessingUnitInstance processingUnitInstance)
addProcessingUnitInstance in interface InternalProcessingUnitpublic void removeProcessingUnitInstance(String uid)
removeProcessingUnitInstance in interface InternalProcessingUnitpublic ProcessingUnitInstanceStatisticsChangedEventManager getProcessingUnitInstanceStatisticsChanged()
getProcessingUnitInstanceStatisticsChanged in interface ProcessingUnitProcessingUnitInstanceStatisticsChangedEvent.
Note, in order to receive events, the virtual machines need to be in a "statistics" monitored state.
public void setStatisticsInterval(long interval,
TimeUnit timeUnit)
StatisticsMonitorsetStatisticsInterval in interface StatisticsMonitorpublic void setStatisticsHistorySize(int historySize)
StatisticsMonitorsetStatisticsHistorySize in interface StatisticsMonitorpublic void startStatisticsMonitor()
StatisticsMonitorstartStatisticsMonitor in interface StatisticsMonitorpublic void stopStatisticsMonitor()
StatisticsMonitorstopStatisticsMonitor in interface StatisticsMonitorpublic boolean isMonitoring()
StatisticsMonitortrue if statistics are now being monitored.isMonitoring in interface StatisticsMonitorpublic void scale(ScaleStrategyConfig strategyConfig)
ProcessingUnitscale in interface ProcessingUnitProcessingUnit.scaleAndWait(ScaleStrategyConfig),
ProcessingUnit.scaleAndWait(ScaleStrategyConfig, long, TimeUnit)public void scaleAndWait(ScaleStrategyConfig strategyConfig)
ProcessingUnitscaleAndWait in interface ProcessingUnitProcessingUnit.scale(ScaleStrategyConfig)public boolean scaleAndWait(ScaleStrategyConfig strategyConfig, long timeout, TimeUnit timeunit)
ProcessingUnitscaleAndWait in interface ProcessingUnitfalse if timeout occurred before scale operation has completed.ProcessingUnit.scale(ScaleStrategyConfig)@Deprecated public void setElasticProperties(Map<String,String> properties)
public String getApplicationName()
getApplicationName in interface InternalProcessingUnitpublic Application getApplication()
getApplication in interface ProcessingUnitpublic void setApplication(Application application)
setApplication in interface InternalApplicationAwarepublic ScaleStrategyConfig getScaleStrategyConfig()
InternalProcessingUnitgetScaleStrategyConfig in interface InternalProcessingUnitpublic boolean decrementPlannedInstances()
InternalProcessingUnitdecrementPlannedInstances in interface InternalProcessingUnittrue if a planned instance was successfully decremented;
false planned instances hasn't changed.public String getApplicationDependencies()
getApplicationDependencies in interface InternalProcessingUnitpublic ProcessingUnitDependencies<ProcessingUnitDependency> getDependencies()
getDependencies in interface ProcessingUnitpublic void processProvisionEvent(org.jini.rio.monitor.ProvisionLifeCycleEvent provisionLifeCycleEvent)
processProvisionEvent in interface InternalProcessingUnitpublic Map<String,InternalProvisionStatusHolder> getProvisionStatusPerInstance()
getProvisionStatusPerInstance in interface InternalProcessingUnitpublic String getSimpleName()
InternalProcessingUnitgetSimpleName in interface InternalProcessingUnitpublic ProcessingUnitInstanceProvisionStatusChangedEventManager getProcessingUnitInstanceProvisionStatusChanged()
getProcessingUnitInstanceProvisionStatusChanged in interface ProcessingUnitProcessingUnitInstanceProvisionStatusChangedEventListeners.public ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventManager getProcessingUnitInstanceMemberAliveIndicatorStatusChanged()
getProcessingUnitInstanceMemberAliveIndicatorStatusChanged in interface ProcessingUnitProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventListeners.public ProcessingUnitStatistics getStatistics()
getStatistics in interface InternalProcessingUnitpublic ExactZonesConfig getHostingGridServiceAgentZones(ProcessingUnitInstance processingUnitInstance) throws AdminException
InternalProcessingUnitgetHostingGridServiceAgentZones in interface InternalProcessingUnitprocessingUnitInstance - AdminExceptionpublic void addStatisticsCalculation(ProcessingUnitStatisticsId statisticsId)
InternalProcessingUnitaddStatisticsCalculation in interface InternalProcessingUnitpublic void removeStatisticsCalculation(ProcessingUnitStatisticsId statisticsId)
InternalProcessingUnitremoveStatisticsCalculation in interface InternalProcessingUnitpublic Set<ProcessingUnitStatisticsId> getStatisticsCalculations()
getStatisticsCalculations in interface InternalProcessingUnitpublic RequiredZonesConfig getRequiredContainerZones()
getRequiredContainerZones in interface ProcessingUnitpublic boolean isBackupGsmInSync()
isBackupGsmInSync in interface InternalProcessingUnitpublic ProcessingUnitInstance getProcessingUnitInstanceByUid(String uid)
InternalProcessingUnitGridComponent.getUid())getProcessingUnitInstanceByUid in interface InternalProcessingUnituid - the unique id of the processing unit instancepublic void setBackupGsmInSync(boolean backupGsmIsInSync)
setBackupGsmInSync in interface InternalProcessingUnitbackupGsmIsInSync - - true if backup GSM is in sync with primary GSM, false if out of
sync.public QuiesceResult quiesce(QuiesceRequest request)
ProcessingUnitProcessingUnit.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)quiesce in interface ProcessingUnitrequest - with the quiesce descriptionQuiesceRequest if the request was approved by
the serverpublic void unquiesce(QuiesceRequest request)
ProcessingUnitProcessingUnit.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)unquiesce in interface ProcessingUnitrequest - with the quiesce descriptionpublic boolean waitFor(QuiesceState desiredState, long timeout, TimeUnit timeUnit)
waitFor in interface ProcessingUnittrue if the processing unit reached to desired as well as all instances in
the requested timeout, false otherwise.public boolean waitFor(QuiesceState desiredState)
ProcessingUnitProcessingUnit.waitFor(com.gigaspaces.admin.quiesce.QuiesceState, long,
java.util.concurrent.TimeUnit) but with endless timeoutwaitFor in interface ProcessingUnitpublic QuiesceDetails getQuiesceDetails()
getQuiesceDetails in interface ProcessingUnitQuiesceDetailspublic String getArchiveName()
getArchiveName in interface ProcessingUnitCopyright © GigaSpaces.