Class DefaultProcessingUnitInstance
- All Implemented Interfaces:
Iterable<ServiceDetails>,AdminAware,DiscoverableComponent,GridComponent,InternalMachineAware,InternalOperatingSystemAware,InternalOperatingSystemInfoProvider,InternalProcessingUnitInstance,InternalDiscoverableComponent,InternalGridComponent,InternalTransportAware,InternalTransportInfoProvider,InternalVirtualMachineAware,InternalVirtualMachineInfoProvider,InternalZoneAware,MachineAware,OperatingSystemAware,ProcessingUnitInstance,StatisticsMonitor,TransportAware,VirtualMachineAware,ZoneAware
- Author:
- kimchy
-
Field Summary
Fields inherited from class org.openspaces.admin.internal.support.AbstractGridComponent
adminFields inherited from interface org.openspaces.admin.StatisticsMonitor
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL -
Constructor Summary
ConstructorsConstructorDescriptionDefaultProcessingUnitInstance(ServiceID serviceID, PUDetails puDetails, PUServiceBean puServiceBean, InternalAdmin admin, JVMDetails jvmDetails) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddSpaceInstanceIfMatching(SpaceInstance spaceInstance) Adds a space instance only if it is one that the processing unit has started.voidDecrements the instance (and destroying it in the process).voiddestroy()Destroy the instance.voidvoidReturns a map ofAsyncPollingEventContainerServiceDetailskeyed by theirServiceDetails.getId().intReturns the backup id of the processing unit instance.Returns the cluster info of the processing unit instance.longReturns the embedded space service details as described by the service started within the processing unit.Returns the embedded space service details as described by the service started within the processing unit.Returns a map ofEventContainerServiceDetailskeyed by theirServiceDetails.getId().Returns theGridServiceContainerthe processing unit is running on.getId()Returns the Processing unit instance IdentifierintReturns the instance id of the processing unit instance.Returns the jee service details of the jee container that was started within this processing unit.This method is non-blocking and should used in conjunction withProcessingUnitInstance.getStatistics()orStatisticsMonitor.setStatisticsInterval(long, java.util.concurrent.TimeUnit)getName()Returns the name of the processing unit.Returns a map ofNotifyEventContainerServiceDetailskeyed by theirServiceDetails.getId().Returns the processing unit partition this processing unit instance is part of.Returns a map ofPollingEventContainerServiceDetailskeyed by theirServiceDetails.getId().Returns the processing unit this processing unit instance belongs to.Get this processing unit instance String representation.
If this processing unit instance represents a Space instance, this method will return a similar result toSpaceInstance.getSpaceInstanceName(), but with the processing unit name as the Space name.Return the properties the processing unit was deployed with.Returns the remoting service details (the exporter) if configured within the processing unit.Returns a map of service details by service id.getServiceDetailsByServiceId(String serviceId) Returns the service details for a specific service id.Returns a map of service details by service type.getServicesDetailsByServiceType(String serviceType) Returns the service details by a service typeServiceDetails.getServiceType().Returns the space service details as described by the service started within the processing unit.Returns a space instance that was started within the processing unit instance.Returns all the space instances that were started within the processing unit instance.Returns the processing unit instance statistics.longgetUid()Returns the unique id of the grid component.booleanReturnstrueif there are embedded spaces started within this processing unit.booleanisJee()Returnstrueif this processing unit is a jee processing unit.booleanReturnstrueif statistics are now being monitored.booleaniterator()voidrelocate()Relocates the instance to any suitableGridServiceContainer.voidrelocate(GridServiceContainer gridServiceContainerToRelocateTo) Relocates the instance to the providedGridServiceContainer.Relocates the any suitableGridServiceContainer.relocateAndWait(long timeout, TimeUnit timeUnit) Relocates the any suitableGridServiceContainer.relocateAndWait(GridServiceContainer gridServiceContainerToRelocateTo) Relocates the instance to the providedGridServiceContainer.relocateAndWait(GridServiceContainer gridServiceContainerToRelocateTo, long timeout, TimeUnit timeUnit) Relocates the instance to the providedGridServiceContainer.voidvoidrestart()Restarts the processing unit instance.Restarts the processing unit instance and waits indefinitely for the restarted processing unit instance returning it.restartAndWait(long timeout, TimeUnit timeUnit) Restarts the processing unit instance and waits for the restarted processing unit instance returning it for the provided timeout.voidrunGc()voidsetClusterInfo(ClusterInfo clusterInfo) voidsetGridServiceContainer(GridServiceContainer gridServiceContainer) voidsetMemberAliveIndicatorStatus(org.jini.rio.monitor.ServiceFaultDetectionEvent serviceFaultDetectionEvent) voidsetProcessingUnit(ProcessingUnit processingUnit) voidsetProcessingUnitPartition(ProcessingUnitPartition processingUnitPartition) voidsetStatisticsHistorySize(int historySize) Sets the history size of number of statistics stored.voidsetStatisticsInterval(long interval, TimeUnit timeUnit) Sets the statistics interval, automatically updating the monitoring scheduled tasks if monitoring is enabled.voidStarts the statistics monitor, starting a scheduled monitor that polls for statistics.voidStops the statistics monitor.waitForSpaceInstance(long timeout, TimeUnit timeUnit) Methods inherited from class org.openspaces.admin.internal.support.AbstractGridComponent
addZone, assertStateChangesPermitted, getAdmin, getJVMDetails, getMachine, getOperatingSystem, getTransport, getVirtualMachine, getZones, isDiscovered, setDiscovered, setMachine, setOperatingSystem, setTransport, setVirtualMachineMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openspaces.admin.AdminAware
getAdminMethods inherited from interface org.openspaces.admin.DiscoverableComponent
isDiscoveredMethods inherited from interface org.openspaces.admin.internal.support.InternalDiscoverableComponent
setDiscoveredMethods inherited from interface org.openspaces.admin.internal.machine.InternalMachineAware
setMachineMethods inherited from interface org.openspaces.admin.internal.os.InternalOperatingSystemAware
setOperatingSystemMethods inherited from interface org.openspaces.admin.internal.transport.InternalTransportAware
setTransportMethods inherited from interface org.openspaces.admin.internal.vm.InternalVirtualMachineAware
setVirtualMachineMethods inherited from interface org.openspaces.admin.internal.vm.InternalVirtualMachineInfoProvider
getJVMDetailsMethods inherited from interface org.openspaces.admin.internal.zone.InternalZoneAware
addZoneMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.openspaces.admin.machine.MachineAware
getMachineMethods inherited from interface org.openspaces.admin.os.OperatingSystemAware
getOperatingSystemMethods inherited from interface org.openspaces.admin.transport.TransportAware
getTransportMethods inherited from interface org.openspaces.admin.vm.VirtualMachineAware
getVirtualMachine
-
Constructor Details
-
DefaultProcessingUnitInstance
public DefaultProcessingUnitInstance(ServiceID serviceID, PUDetails puDetails, PUServiceBean puServiceBean, InternalAdmin admin, JVMDetails jvmDetails)
-
-
Method Details
-
getUid
Description copied from interface:GridComponentReturns the unique id of the grid component.- Specified by:
getUidin interfaceGridComponent- Specified by:
getUidin interfaceInternalVirtualMachineInfoProvider
-
getId
Description copied from interface:ProcessingUnitInstanceReturns the Processing unit instance Identifier- Specified by:
getIdin interfaceProcessingUnitInstance
-
getInstanceId
public int getInstanceId()Description copied from interface:ProcessingUnitInstanceReturns the instance id of the processing unit instance.- Specified by:
getInstanceIdin interfaceProcessingUnitInstance
-
getBackupId
public int getBackupId()Description copied from interface:ProcessingUnitInstanceReturns the backup id of the processing unit instance.- Specified by:
getBackupIdin interfaceProcessingUnitInstance
-
getServiceID
- Specified by:
getServiceIDin interfaceInternalProcessingUnitInstance
-
getProcessingUnit
Description copied from interface:ProcessingUnitInstanceReturns the processing unit this processing unit instance belongs to.- Specified by:
getProcessingUnitin interfaceProcessingUnitInstance
-
getName
Description copied from interface:ProcessingUnitInstanceReturns the name of the processing unit.- Specified by:
getNamein interfaceProcessingUnitInstance
-
getProcessingUnitInstanceName
Description copied from interface:ProcessingUnitInstanceGet this processing unit instance String representation.
If this processing unit instance represents a Space instance, this method will return a similar result toSpaceInstance.getSpaceInstanceName(), but with the processing unit name as the Space name. Otherwise, it will return: {Processing unit name} [instance id] - the name of this processing unit (seeProcessingUnitInstance.getName()) and the instance id (seeProcessingUnitInstance.getInstanceId()); for example, MyPU [3]- Specified by:
getProcessingUnitInstanceNamein interfaceProcessingUnitInstance- Returns:
- this processing unit instance String representation.
-
getProcessingUnitInstanceSimpleName
- Specified by:
getProcessingUnitInstanceSimpleNamein interfaceInternalProcessingUnitInstance- Returns:
- Return instance name without prefix of application name ( if exists )
-
setProcessingUnit
- Specified by:
setProcessingUnitin interfaceInternalProcessingUnitInstance
-
getClusterInfo
Description copied from interface:ProcessingUnitInstanceReturns the cluster info of the processing unit instance.- Specified by:
getClusterInfoin interfaceProcessingUnitInstance
-
getProperties
Description copied from interface:ProcessingUnitInstanceReturn the properties the processing unit was deployed with.- Specified by:
getPropertiesin interfaceProcessingUnitInstance
-
iterator
- Specified by:
iteratorin interfaceIterable<ServiceDetails>
-
getEventContainerDetails
Description copied from interface:ProcessingUnitInstanceReturns a map ofEventContainerServiceDetailskeyed by theirServiceDetails.getId().- Specified by:
getEventContainerDetailsin interfaceProcessingUnitInstance
-
getPollingEventContainerDetails
Description copied from interface:ProcessingUnitInstanceReturns a map ofPollingEventContainerServiceDetailskeyed by theirServiceDetails.getId().- Specified by:
getPollingEventContainerDetailsin interfaceProcessingUnitInstance
-
getNotifyEventContainerDetails
Description copied from interface:ProcessingUnitInstanceReturns a map ofNotifyEventContainerServiceDetailskeyed by theirServiceDetails.getId().- Specified by:
getNotifyEventContainerDetailsin interfaceProcessingUnitInstance
-
getAsyncPollingEventContainerDetails
Description copied from interface:ProcessingUnitInstanceReturns a map ofAsyncPollingEventContainerServiceDetailskeyed by theirServiceDetails.getId().- Specified by:
getAsyncPollingEventContainerDetailsin interfaceProcessingUnitInstance
-
getSpaceDetails
Description copied from interface:ProcessingUnitInstanceReturns the space service details as described by the service started within the processing unit.- Specified by:
getSpaceDetailsin interfaceProcessingUnitInstance
-
getEmbeddedSpaceDetails
Description copied from interface:ProcessingUnitInstanceReturns the embedded space service details as described by the service started within the processing unit.nullif no embedded space was started within the processing unit.- Specified by:
getEmbeddedSpaceDetailsin interfaceProcessingUnitInstance
-
getEmbeddedSpacesDetails
Description copied from interface:ProcessingUnitInstanceReturns the embedded space service details as described by the service started within the processing unit.- Specified by:
getEmbeddedSpacesDetailsin interfaceProcessingUnitInstance
-
getServicesDetails
-
getGridServiceContainerServiceID
- Specified by:
getGridServiceContainerServiceIDin interfaceInternalProcessingUnitInstance
-
setGridServiceContainer
- Specified by:
setGridServiceContainerin interfaceInternalProcessingUnitInstance
-
getGridServiceContainer
Description copied from interface:ProcessingUnitInstanceReturns theGridServiceContainerthe processing unit is running on.- Specified by:
getGridServiceContainerin interfaceProcessingUnitInstance
-
setProcessingUnitPartition
- Specified by:
setProcessingUnitPartitionin interfaceInternalProcessingUnitInstance
-
getPartition
Description copied from interface:ProcessingUnitInstanceReturns the processing unit partition this processing unit instance is part of.- Specified by:
getPartitionin interfaceProcessingUnitInstance
-
getPUServiceBean
- Specified by:
getPUServiceBeanin interfaceInternalProcessingUnitInstance
-
isEmbeddedSpaces
public boolean isEmbeddedSpaces()Description copied from interface:ProcessingUnitInstanceReturnstrueif there are embedded spaces started within this processing unit.- Specified by:
isEmbeddedSpacesin interfaceProcessingUnitInstance
-
getSpaceInstance
Description copied from interface:ProcessingUnitInstanceReturns a space instance that was started within the processing unit instance. Will returnnullif no embedded space instances were started (or none has been detected yet).- Specified by:
getSpaceInstancein interfaceProcessingUnitInstance
-
getSpaceInstances
Description copied from interface:ProcessingUnitInstanceReturns all the space instances that were started within the processing unit instance. Will return an empty array if no space instances were started within this processing unit (or none has been detected yet).- Specified by:
getSpaceInstancesin interfaceProcessingUnitInstance
-
waitForSpaceInstance
- Specified by:
waitForSpaceInstancein interfaceProcessingUnitInstance
-
waitForSpaceInstance
- Specified by:
waitForSpaceInstancein interfaceProcessingUnitInstance
-
addSpaceInstanceIfMatching
Description copied from interface:InternalProcessingUnitInstanceAdds a space instance only if it is one that the processing unit has started.- Specified by:
addSpaceInstanceIfMatchingin interfaceInternalProcessingUnitInstance
-
removeSpaceInstance
- Specified by:
removeSpaceInstancein interfaceInternalProcessingUnitInstance
-
isJee
public boolean isJee()Description copied from interface:ProcessingUnitInstanceReturnstrueif this processing unit is a jee processing unit.- Specified by:
isJeein interfaceProcessingUnitInstance
-
getJeeDetails
Description copied from interface:ProcessingUnitInstanceReturns the jee service details of the jee container that was started within this processing unit.- Specified by:
getJeeDetailsin interfaceProcessingUnitInstance
-
getRemotingDetails
Description copied from interface:ProcessingUnitInstanceReturns the remoting service details (the exporter) if configured within the processing unit.- Specified by:
getRemotingDetailsin interfaceProcessingUnitInstance
-
getServiceDetailsByServiceId
Description copied from interface:ProcessingUnitInstanceReturns the service details for a specific service id.- Specified by:
getServiceDetailsByServiceIdin interfaceProcessingUnitInstance
-
getServiceDetailsByServiceId
Description copied from interface:ProcessingUnitInstanceReturns a map of service details by service id.- Specified by:
getServiceDetailsByServiceIdin interfaceProcessingUnitInstance
-
getServicesDetailsByServiceType
Description copied from interface:ProcessingUnitInstanceReturns the service details by a service typeServiceDetails.getServiceType().- Specified by:
getServicesDetailsByServiceTypein interfaceProcessingUnitInstance
-
getServiceDetailsByServiceType
Description copied from interface:ProcessingUnitInstanceReturns a map of service details by service type.- Specified by:
getServiceDetailsByServiceTypein interfaceProcessingUnitInstance
-
destroy
public void destroy()Description copied from interface:ProcessingUnitInstanceDestroy the instance. If breaches the SLA, will instantiate the instance again.- Specified by:
destroyin interfaceProcessingUnitInstance
-
relocate
Description copied from interface:ProcessingUnitInstanceRelocates the instance to the providedGridServiceContainer.Note, the current processing instance is unusable once this call has been made. If the relocated processing unit instance is needed, or waiting for the relocation is required, use
ProcessingUnitInstance.relocateAndWait(org.openspaces.admin.gsc.GridServiceContainer)orProcessingUnitInstance.relocateAndWait(org.openspaces.admin.gsc.GridServiceContainer, long, java.util.concurrent.TimeUnit).- Specified by:
relocatein interfaceProcessingUnitInstance
-
relocateAndWait
public ProcessingUnitInstance relocateAndWait(GridServiceContainer gridServiceContainerToRelocateTo) Description copied from interface:ProcessingUnitInstanceRelocates the instance to the providedGridServiceContainer. The relocated instance will be returned waiting for it indefinitely.- Specified by:
relocateAndWaitin interfaceProcessingUnitInstance
-
relocateAndWait
public ProcessingUnitInstance relocateAndWait(GridServiceContainer gridServiceContainerToRelocateTo, long timeout, TimeUnit timeUnit) Description copied from interface:ProcessingUnitInstanceRelocates the instance to the providedGridServiceContainer. The relocated instance will be returned waiting for it for the provided timeout.- Specified by:
relocateAndWaitin interfaceProcessingUnitInstance
-
relocate
public void relocate()Description copied from interface:ProcessingUnitInstanceRelocates the instance to any suitableGridServiceContainer.Note, the current processing instance is unusable once this call has been made. If the relocated processing unit instance is needed, or waiting for the relocation is required, use
ProcessingUnitInstance.relocateAndWait()orProcessingUnitInstance.relocateAndWait(long, java.util.concurrent.TimeUnit).- Specified by:
relocatein interfaceProcessingUnitInstance
-
relocateAndWait
Description copied from interface:ProcessingUnitInstanceRelocates the any suitableGridServiceContainer. The relocated instance will be returned waiting for it indefinitely.- Specified by:
relocateAndWaitin interfaceProcessingUnitInstance
-
relocateAndWait
Description copied from interface:ProcessingUnitInstanceRelocates the any suitableGridServiceContainer. The relocated instance will be returned waiting for it for the provided timeout.- Specified by:
relocateAndWaitin interfaceProcessingUnitInstance
-
restart
public void restart()Description copied from interface:ProcessingUnitInstanceRestarts the processing unit instance. Note, if this instance is running an embedded space instance, and the space instance is primary and there is a backup around as well, this method is handy to "turn" the backup to primary.Note, the current processing unit instance is unusable once this call has been made. If the restarted processing unit instance is needed, or waiting for the restart is required, use
ProcessingUnitInstance.restartAndWait()orProcessingUnitInstance.restartAndWait(long, java.util.concurrent.TimeUnit).- Specified by:
restartin interfaceProcessingUnitInstance
-
restartAndWait
Description copied from interface:ProcessingUnitInstanceRestarts the processing unit instance and waits indefinitely for the restarted processing unit instance returning it.- Specified by:
restartAndWaitin interfaceProcessingUnitInstance- See Also:
-
restartAndWait
Description copied from interface:ProcessingUnitInstanceRestarts the processing unit instance and waits for the restarted processing unit instance returning it for the provided timeout.- Specified by:
restartAndWaitin interfaceProcessingUnitInstance- See Also:
-
decrement
public void decrement()Description copied from interface:ProcessingUnitInstanceDecrements the instance (and destroying it in the process). Will not attempt to create it again. Does not apply for partitioned nor replicated topologies.- Specified by:
decrementin interfaceProcessingUnitInstance- See Also:
-
getLastStatistics
Description copied from interface:InternalProcessingUnitInstanceThis method is non-blocking and should used in conjunction withProcessingUnitInstance.getStatistics()orStatisticsMonitor.setStatisticsInterval(long, java.util.concurrent.TimeUnit)- Specified by:
getLastStatisticsin interfaceInternalProcessingUnitInstance- Returns:
- the last statistics (regardless of its timestamp), or null if no statistics has been ever collected.
-
getStatistics
Description copied from interface:ProcessingUnitInstanceReturns the processing unit instance statistics.- Specified by:
getStatisticsin interfaceProcessingUnitInstance
-
setStatisticsInterval
Description copied from interface:StatisticsMonitorSets the statistics interval, automatically updating the monitoring scheduled tasks if monitoring is enabled.- Specified by:
setStatisticsIntervalin interfaceStatisticsMonitor
-
getStatisticsIntervalMilliseconds
public long getStatisticsIntervalMilliseconds()- Specified by:
getStatisticsIntervalMillisecondsin interfaceInternalProcessingUnitInstance- Returns:
- the statistics interval milliseconds
-
setClusterInfo
- Specified by:
setClusterInfoin interfaceInternalProcessingUnitInstance
-
setStatisticsHistorySize
public void setStatisticsHistorySize(int historySize) Description copied from interface:StatisticsMonitorSets the history size of number of statistics stored.- Specified by:
setStatisticsHistorySizein interfaceStatisticsMonitor
-
startStatisticsMonitor
public void startStatisticsMonitor()Description copied from interface:StatisticsMonitorStarts the statistics monitor, starting a scheduled monitor that polls for statistics. Monitoring is required only when wanting to receive statistics change events.- Specified by:
startStatisticsMonitorin interfaceStatisticsMonitor
-
stopStatisticsMonitor
public void stopStatisticsMonitor()Description copied from interface:StatisticsMonitorStops the statistics monitor.- Specified by:
stopStatisticsMonitorin interfaceStatisticsMonitor
-
isMonitoring
public boolean isMonitoring()Description copied from interface:StatisticsMonitorReturnstrueif statistics are now being monitored.- Specified by:
isMonitoringin interfaceStatisticsMonitor
-
getNIODetails
- Specified by:
getNIODetailsin interfaceInternalTransportInfoProvider- Throws:
RemoteException
-
getNIOStatistics
- Specified by:
getNIOStatisticsin interfaceInternalTransportInfoProvider- Throws:
RemoteException
-
enableLRMIMonitoring
- Specified by:
enableLRMIMonitoringin interfaceInternalTransportInfoProvider- Throws:
RemoteException
-
disableLRMIMonitoring
- Specified by:
disableLRMIMonitoringin interfaceInternalTransportInfoProvider- Throws:
RemoteException
-
fetchLRMIMonitoringDetails
- Specified by:
fetchLRMIMonitoringDetailsin interfaceInternalTransportInfoProvider- Throws:
RemoteException
-
getCurrentTimeInMillis
- Specified by:
getCurrentTimeInMillisin interfaceInternalOperatingSystemInfoProvider- Throws:
RemoteException
-
getOSDetails
- Specified by:
getOSDetailsin interfaceInternalOperatingSystemInfoProvider- Throws:
RemoteException
-
getOSStatistics
- Specified by:
getOSStatisticsin interfaceInternalOperatingSystemInfoProvider- Throws:
RemoteException
-
getJVMStatistics
- Specified by:
getJVMStatisticsin interfaceInternalVirtualMachineInfoProvider- Throws:
RemoteException
-
runGc
- Specified by:
runGcin interfaceInternalVirtualMachineInfoProvider- Throws:
RemoteException
-
invoke
- Specified by:
invokein interfaceInternalProcessingUnitInstance
-
isUndeploying
public boolean isUndeploying()- Specified by:
isUndeployingin interfaceInternalProcessingUnitInstance
-
setMemberAliveIndicatorStatus
public void setMemberAliveIndicatorStatus(org.jini.rio.monitor.ServiceFaultDetectionEvent serviceFaultDetectionEvent) - Specified by:
setMemberAliveIndicatorStatusin interfaceInternalProcessingUnitInstance
-
getMemberAliveIndicatorStatus
- Specified by:
getMemberAliveIndicatorStatusin interfaceProcessingUnitInstance- Returns:
- Returns the current member alive indicator status of this processing unit instance.
-