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) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DefaultProcessingUnit(InternalAdmin admin, InternalProcessingUnits processingUnits, com.gigaspaces.grid.gsm.PUDetails details, BeanLevelProperties beanLevelProperties)
public ProcessingUnits getProcessingUnits()
getProcessingUnits
in interface ProcessingUnit
public Admin getAdmin()
AdminAware
Admin
associated with this element.getAdmin
in interface AdminAware
public String getName()
getName
in interface ProcessingUnit
public BeanLevelProperties getBeanLevelProperties()
getBeanLevelProperties
in interface ProcessingUnit
public ProcessingUnitType getType()
getType
in interface ProcessingUnit
public ManagingGridServiceManagerChangedEventManager getManagingGridServiceManagerChanged()
getManagingGridServiceManagerChanged
in interface ProcessingUnit
ManagingGridServiceManagerChangedEvent
s.public void setLogLevel(String loggerName, String level) throws AdminException
setLogLevel
in interface ProcessingUnit
AdminException
public BackupGridServiceManagerChangedEventManager getBackupGridServiceManagerChanged()
getBackupGridServiceManagerChanged
in interface ProcessingUnit
BackupGridServiceManagerChangedEvent
s.public boolean hasSpace()
ProcessingUnit
hasSpace
in interface ProcessingUnit
public Space getSpace()
getSpace
in interface ProcessingUnit
null
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 ProcessingUnit
public void addEmbeddedSpace(Space space)
addEmbeddedSpace
in interface InternalProcessingUnit
public boolean removeEmbeddedSpace(Space space)
removeEmbeddedSpace
in interface InternalProcessingUnit
public ProcessingUnitStatusChangedEventManager getProcessingUnitStatusChanged()
getProcessingUnitStatusChanged
in interface ProcessingUnit
ProcessingUnitStatusChangedEvent
s.public ProcessingUnitInstanceAddedEventManager getProcessingUnitInstanceAdded()
getProcessingUnitInstanceAdded
in interface ProcessingUnit
ProcessingUnitInstanceAddedEventListener
s.public ProcessingUnitInstanceRemovedEventManager getProcessingUnitInstanceRemoved()
getProcessingUnitInstanceRemoved
in interface ProcessingUnit
ProcessingUnitInstanceRemovedEventListener
s.public ProcessingUnitSpaceCorrelatedEventManager getSpaceCorrelated()
getSpaceCorrelated
in interface ProcessingUnit
ProcessingUnitSpaceCorrelatedEvent
s.public ProcessingUnitInstance getProcessingUnitInstance(int instanceId, int backupId)
getProcessingUnitInstance
in interface ProcessingUnit
public void addLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
ProcessingUnit
addLifecycleListener
in interface ProcessingUnit
public void removeLifecycleListener(ProcessingUnitInstanceLifecycleEventListener eventListener)
ProcessingUnit
ProcessingUnitInstanceLifecycleEventListener
.removeLifecycleListener
in interface ProcessingUnit
@Deprecated public int getNumberOfInstances()
getNumberOfInstances
in interface ProcessingUnit
public int getPlannedNumberOfPartitions()
ProcessingUnit
ProcessingUnit.getPartitions()
.getPlannedNumberOfPartitions
in interface ProcessingUnit
public int getPlannedNumberOfInstances()
ProcessingUnit
ProcessingUnit.getInstances()
.getPlannedNumberOfInstances
in interface ProcessingUnit
public void setNumberOfInstances(int numberOfInstances)
setNumberOfInstances
in interface InternalProcessingUnit
public int getNumberOfBackups()
getNumberOfBackups
in interface ProcessingUnit
public void setNumberOfBackups(int numberOfBackups)
setNumberOfBackups
in interface InternalProcessingUnit
@Deprecated public int getTotalNumberOfInstances()
getTotalNumberOfInstances
in interface ProcessingUnit
ProcessingUnit.getNumberOfInstances()
. If there are backups, will
return ProcessingUnit.getNumberOfInstances()
* (ProcessingUnit.getNumberOfBackups()
+ 1)public int getMaxInstancesPerVM()
getMaxInstancesPerVM
in interface ProcessingUnit
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).
public boolean isRequiresIsolation()
isRequiresIsolation
in interface ProcessingUnit
public int getMaxInstancesPerMachine()
getMaxInstancesPerMachine
in interface ProcessingUnit
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).
public String getClusterSchema()
getClusterSchema
in interface InternalProcessingUnit
public Map<String,Integer> getMaxInstancesPerZone()
getMaxInstancesPerZone
in interface ProcessingUnit
public String[] getRequiredZones()
getRequiredZones
in interface ProcessingUnit
public Set<String> getPrimaryZones()
getPrimaryZones
in interface ProcessingUnit
public DeploymentStatus getStatus()
getStatus
in interface ProcessingUnit
public boolean waitFor(int numberOfProcessingUnitInstances)
ProcessingUnit
waitFor
in interface ProcessingUnit
true
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)
ProcessingUnit
waitFor
in interface ProcessingUnit
true
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()
ProcessingUnit
waitForSpace
in interface ProcessingUnit
null
if the waiting time elapsed before
correlation took place.public Space waitForSpace(long timeout, TimeUnit timeUnit)
ProcessingUnit
waitForSpace
in interface ProcessingUnit
null
if the waiting time elapsed before
correlation took place.public GridServiceManager waitForManaged()
ProcessingUnit
GridServiceManager
for the
processing unit.waitForManaged
in interface ProcessingUnit
null
if the waiting time elapsed before
discovery took place.public GridServiceManager waitForManaged(long timeout, TimeUnit timeUnit)
ProcessingUnit
GridServiceManager
for the
processing unit for the specified timeout.waitForManaged
in interface ProcessingUnit
null
if the waiting time elapsed before
discovery took place.public boolean canIncrementInstance()
canIncrementInstance
in interface ProcessingUnit
true
if this processing unit allows to increment instances on
it.public boolean canDecrementInstance()
canDecrementInstance
in interface ProcessingUnit
true
if this processing unit allows to decrement instances on
it.public void incrementInstance()
ProcessingUnit
incrementInstance
in interface ProcessingUnit
public void decrementInstance()
ProcessingUnit
ProcessingUnitInstance.decrement()
instead. Does not
apply for partitioned nor replicated topologies.decrementInstance
in interface ProcessingUnit
public GridServiceManager getManagingGridServiceManager()
getManagingGridServiceManager
in interface ProcessingUnit
public GridServiceManager[] getBackupGridServiceManagers()
getBackupGridServiceManagers
in interface ProcessingUnit
public boolean isManaged()
isManaged
in interface ProcessingUnit
true
if there is a managing GSM for it.public GridServiceManager getBackupGridServiceManager(String gridServiceManagerUID)
getBackupGridServiceManager
in interface ProcessingUnit
public CompletableFuture<?> undeployAsync()
undeployAsync
in interface ProcessingUnit
public CompletableFuture<?> undeployAsync(UndeployOptions options)
undeployAsync
in interface ProcessingUnit
options
- determine the wanted drain behaviour before undeployUndeployOptions
public boolean undeployAndWait(long timeout, TimeUnit timeUnit)
ProcessingUnit
The undeployment process will wait for the given timeout and return when all processing units have undeployed or timeout expired.
undeployAndWait
in interface ProcessingUnit
ProcessingUnit.undeployAsync()
,
ProcessingUnit.undeployAndWait()
,
ProcessingUnit.undeploy()
public void undeployAndWait()
ProcessingUnit
The undeployment process will wait indefinitely and return when all processing units have undeployed.
undeployAndWait
in interface ProcessingUnit
ProcessingUnit.undeployAsync()
,
ProcessingUnit.undeployAndWait(long, TimeUnit)
,
ProcessingUnit.undeploy()
public void undeploy()
undeploy
in interface ProcessingUnit
()
,
ProcessingUnit.undeployAndWait()
,
ProcessingUnit.undeployAndWait(long, TimeUnit)
public void setManagingGridServiceManager(GridServiceManager gridServiceManager)
setManagingGridServiceManager
in interface InternalProcessingUnit
public void addManagingGridServiceManager(GridServiceManager gridServiceManager)
addManagingGridServiceManager
in interface InternalProcessingUnit
public void addBackupGridServiceManager(GridServiceManager backupGridServiceManager)
addBackupGridServiceManager
in interface InternalProcessingUnit
public void removeBackupGridServiceManager(String gsmUID)
removeBackupGridServiceManager
in interface InternalProcessingUnit
public boolean setStatus(int statusCode)
setStatus
in interface InternalProcessingUnit
public Iterator<ProcessingUnitInstance> iterator()
iterator
in interface Iterable<ProcessingUnitInstance>
public ProcessingUnitInstance[] getInstances()
getInstances
in interface ProcessingUnit
public ProcessingUnitInstance[] getProcessingUnitInstances()
getProcessingUnitInstances
in interface InternalProcessingUnitInstancesAware
public ProcessingUnitPartition[] getPartitions()
getPartitions
in interface ProcessingUnit
public ProcessingUnitPartition getPartition(int partitionId)
getPartition
in interface ProcessingUnit
public void addProcessingUnitInstance(ProcessingUnitInstance processingUnitInstance)
addProcessingUnitInstance
in interface InternalProcessingUnit
public void removeProcessingUnitInstance(String uid)
removeProcessingUnitInstance
in interface InternalProcessingUnit
public ProcessingUnitInstanceStatisticsChangedEventManager getProcessingUnitInstanceStatisticsChanged()
getProcessingUnitInstanceStatisticsChanged
in interface ProcessingUnit
ProcessingUnitInstanceStatisticsChangedEvent
.
Note, in order to receive events, the virtual machines need to be in a "statistics" monitored state.
public void setStatisticsInterval(long interval, TimeUnit timeUnit)
StatisticsMonitor
setStatisticsInterval
in interface StatisticsMonitor
public void setStatisticsHistorySize(int historySize)
StatisticsMonitor
setStatisticsHistorySize
in interface StatisticsMonitor
public void startStatisticsMonitor()
StatisticsMonitor
startStatisticsMonitor
in interface StatisticsMonitor
public void stopStatisticsMonitor()
StatisticsMonitor
stopStatisticsMonitor
in interface StatisticsMonitor
public boolean isMonitoring()
StatisticsMonitor
true
if statistics are now being monitored.isMonitoring
in interface StatisticsMonitor
public String getApplicationName()
getApplicationName
in interface InternalProcessingUnit
public Application getApplication()
getApplication
in interface ProcessingUnit
public void setApplication(Application application)
setApplication
in interface InternalApplicationAware
public boolean decrementPlannedInstances()
InternalProcessingUnit
decrementPlannedInstances
in interface InternalProcessingUnit
true
if a planned instance was successfully decremented;
false
planned instances hasn't changed.public String getApplicationDependencies()
getApplicationDependencies
in interface InternalProcessingUnit
public ProcessingUnitDependencies<ProcessingUnitDependency> getDependencies()
getDependencies
in interface ProcessingUnit
public void processProvisionEvent(org.jini.rio.monitor.ProvisionLifeCycleEvent provisionLifeCycleEvent)
processProvisionEvent
in interface InternalProcessingUnit
public Map<String,InternalProvisionStatusHolder> getProvisionStatusPerInstance()
getProvisionStatusPerInstance
in interface InternalProcessingUnit
public String getSimpleName()
InternalProcessingUnit
getSimpleName
in interface InternalProcessingUnit
public ProcessingUnitInstanceProvisionStatusChangedEventManager getProcessingUnitInstanceProvisionStatusChanged()
getProcessingUnitInstanceProvisionStatusChanged
in interface ProcessingUnit
ProcessingUnitInstanceProvisionStatusChangedEventListener
s.public ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventManager getProcessingUnitInstanceMemberAliveIndicatorStatusChanged()
getProcessingUnitInstanceMemberAliveIndicatorStatusChanged
in interface ProcessingUnit
ProcessingUnitInstanceMemberAliveIndicatorStatusChangedEventListener
s.public ProcessingUnitStatistics getStatistics()
getStatistics
in interface InternalProcessingUnit
public ExactZonesConfig getHostingGridServiceAgentZones(ProcessingUnitInstance processingUnitInstance) throws AdminException
InternalProcessingUnit
getHostingGridServiceAgentZones
in interface InternalProcessingUnit
processingUnitInstance
- AdminException
public void addStatisticsCalculation(ProcessingUnitStatisticsId statisticsId)
InternalProcessingUnit
addStatisticsCalculation
in interface InternalProcessingUnit
public void removeStatisticsCalculation(ProcessingUnitStatisticsId statisticsId)
InternalProcessingUnit
removeStatisticsCalculation
in interface InternalProcessingUnit
public Set<ProcessingUnitStatisticsId> getStatisticsCalculations()
getStatisticsCalculations
in interface InternalProcessingUnit
public RequiredZonesConfig getRequiredContainerZones()
getRequiredContainerZones
in interface ProcessingUnit
public GridServiceContainer[] getGridServiceContainers()
getGridServiceContainers
in interface ProcessingUnit
public boolean isBackupGsmInSync()
isBackupGsmInSync
in interface InternalProcessingUnit
public ProcessingUnitInstance getProcessingUnitInstanceByUid(String uid)
InternalProcessingUnit
GridComponent.getUid()
)getProcessingUnitInstanceByUid
in interface InternalProcessingUnit
uid
- the unique id of the processing unit instancepublic boolean isStandaloneProcessingUnit()
isStandaloneProcessingUnit
in interface InternalProcessingUnit
public void setBackupGsmInSync(boolean backupGsmIsInSync)
setBackupGsmInSync
in interface InternalProcessingUnit
backupGsmIsInSync
- - true if backup GSM is in sync with primary GSM, false if out of
sync.public QuiesceResult quiesce(QuiesceRequest request)
ProcessingUnit
ProcessingUnit.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 ProcessingUnit
request
- with the quiesce descriptionQuiesceRequest
if the request was approved by
the serverpublic QuiesceResult quiesceUnsafe(QuiesceRequest request) throws IOException, QuiesceFailedException
request
- IOException
QuiesceFailedException
public void unquiesce(QuiesceRequest request)
ProcessingUnit
ProcessingUnit.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 ProcessingUnit
request
- with the quiesce descriptionpublic boolean waitFor(QuiesceState desiredState, long timeout, TimeUnit timeUnit)
waitFor
in interface ProcessingUnit
true
if the processing unit reached to desired as well as all instances in
the requested timeout, false
otherwise.public boolean waitFor(QuiesceState desiredState)
ProcessingUnit
ProcessingUnit.waitFor(com.gigaspaces.admin.quiesce.QuiesceState, long,
java.util.concurrent.TimeUnit)
but with endless timeoutwaitFor
in interface ProcessingUnit
public QuiesceDetails getQuiesceDetails()
getQuiesceDetails
in interface ProcessingUnit
QuiesceDetails
public String getArchiveName()
getArchiveName
in interface ProcessingUnit
public void scaleHorizontal(int target, String memory, String cpu, String requestId)
scaleHorizontal
in interface InternalProcessingUnit
public void cancelScaleOut() throws IOException, TimeoutException, InterruptedException
cancelScaleOut
in interface InternalProcessingUnit
IOException
TimeoutException
InterruptedException
public void scaleVertical(String memory, String cpu, Long timeout, PuScaleVStatusChangedEventListener listener)
scaleVertical
in interface InternalProcessingUnit
public ClusterTopology getClusterTopology() throws IOException
getClusterTopology
in interface InternalProcessingUnit
IOException
public SharedLock lock() throws Exception
lock
in interface InternalProcessingUnit
Exception
public SharedLock lock(long timeout, TimeUnit timeunit) throws IOException, TimeoutException, InterruptedException
lock
in interface InternalProcessingUnit
IOException
TimeoutException
InterruptedException
public void setStub(boolean stub)
setStub
in interface InternalProcessingUnit
stub
- - true if PU was created before any instancepublic boolean isStub()
isStub
in interface InternalProcessingUnit
public void updateStub(ProcessingUnitInstance processingUnitInstance)
updateStub
in interface InternalProcessingUnit
Copyright © GigaSpaces.