Class DefaultAdmin
java.lang.Object
org.openspaces.admin.internal.admin.DefaultAdmin
- All Implemented Interfaces:
Admin,DumpProvider,InternalAdmin,StatisticsMonitor
- Author:
- kimchy, itaif - added Applications
-
Field Summary
Fields inherited from interface org.openspaces.admin.StatisticsMonitor
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAdmin(boolean useDaemonThreads, boolean singleThreadedEventListeners) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventListener(AdminEventListener eventListener) Smart addition of event listeners.voidaddEventListener(AdminEventListener eventListener, boolean withStatisticsHistory) Smart addition of event listeners.voidaddGatewayProcessingUnit(GatewayProcessingUnit gatewayProcessingUnit) voidaddGridServiceAgent(InternalGridServiceAgent gridServiceAgent, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) voidaddGridServiceContainer(InternalGridServiceContainer gridServiceContainer, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) voidaddGridServiceManager(InternalGridServiceManager gridServiceManager, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones, boolean acceptVM) voidvoidaddLocator(String locator) voidaddLookupService(InternalLookupService lookupService, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) voidaddProcessingUnitInstance(InternalProcessingUnitInstance processingUnitInstance, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) voidaddSpaceInstance(InternalSpaceInstance spaceInstance, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) voidvoidbegin()voidclose()Closes the Admin, releasing any resource and stops listening for events from the lookup service.protected voidvoidvoidgenerateDump(String cause, Map<String, Object> context) Generates dump for all the provided dump processors.Generates dump for the provided processors.generateDump(Set<DumpProvider> dumpProviders, DumpGeneratedListener listener, String cause, Map<String, Object> context, String... processor) Generates dump for an explicit set of dump providers.org.apache.commons.logging.LogReturns the alert manager through which alert strategies are managed, alerts are fired and alert events are registered for.org.openspaces.zookeeper.attribute_store.ZooKeeperAttributeStorelongintReturns number of registered event listeners.Returns the Gateway Processing Units discovered.Returns the gateways discovered.Returns the Grid Component represented by this UID; e.g.Returns the grid service agents discovered.Returns the grid service containers discovered.Returns the grid service managers discovered.String[]Returns the lookup groups this admin uses.Returns the lookup locators this admin uses.Returns the lookup services discovered.Returns the machines discovered.Returns the cluster manager information (if not initialized yet - return null)Returns the Operating Systems discovered.Returns the Processing Units discovered.longReturns the spaces discovered.Returns the transports discovered.Returns the Virtual Machines discovered.getZones()Returns the zones discovered.voidinitManagerClusterInfo(ManagerClusterInfo extractedClusterInfo) booleanReturnstrueif statistics are now being monitored.booleanvoidlogin(SecuredService service) voidvoidpushEventAsFirst(Object listener, Runnable notifier) voidpushScheduleMonitorCorrelatedEvent(Object listener, Runnable notifier) All events that need to be correlated with the Admin ScheduledMonitor polling mechanism.voidraiseEvent(Object listener, Runnable notifier) voidremoveEventListener(AdminEventListener eventListener) Smart removal of event listeners.voidvoidvoidvoidvoidvoidremoveProcessingUnitInstance(String uid, boolean removeEmbeddedSpaces) voidvoidscheduleAdminOperation(Runnable command) A generic thread pool for network based operations such as creating a new grid service container.voidscheduleNonBlockingStateChange(Runnable command) Any internal admin objects state change must be scheduled using this method.scheduleOneTimeWithDelayNonBlockingStateChange(Runnable command, long delay, TimeUnit unit) Any internal delayed admin objects state change based on polling must be scheduled using this method.scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) scheduleWithFixedDelayNonBlockingStateChange(Runnable command, long initialDelay, long delay, TimeUnit unit) Any internal admin objects state change based on polling must be scheduled using this method.voidsetAdminFilter(AdminFilter adminFilter) voidsetAgentProcessessMonitorInterval(long interval, TimeUnit timeUnit) Sets the Grid Service Agent processes monitor (not statistics) interval.voidsetCredentialsProvider(CredentialsProvider credentialsProvider) voidsetDefaultTimeout(long timeout, TimeUnit timeUnit) The default timeout to be used for operations that have a wait for mechanism, i.e.voidsetDiscoveryServices(Class... discoveryServices) Set the service types that will be monitored Supported types:GridServiceAgent,GridServiceManager,GridServiceContainer,ProcessingUnit,SpacevoidsetProcessingUnitMonitorInterval(long interval, TimeUnit timeUnit) Sets the processing unit monitor (not statistics) interval.voidsetSchedulerCorePoolSize(int coreThreads) The Admin API uses a shared scheduler thread pool to perform *all* scheduled operations (monitoring, statistics monitoring).voidsetSpaceMonitorInterval(long interval, TimeUnit timeUnit) Sets the Space monitor (not statistics) interval.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.Waits indefinitely for the cluster manager information to be initialized, then return itwaitForManagerClusterInfo(long timeout, TimeUnit timeUnit) Waits for the specified timeout for the cluster manager information to be initialized, then return it.
-
Constructor Details
-
DefaultAdmin
public DefaultAdmin(boolean useDaemonThreads, boolean singleThreadedEventListeners) - Parameters:
useDaemonThreads- Sets worker and events threads to be automatically closed when the process dies.singleThreadedEventListeners- Enables a single event loop threading model in which all event listeners and admin state updates are done on the same thread. The underlying assumption is that event listeners do not perform an I/O operation so they won't block the single event thread. Call this method before begin()
-
-
Method Details
-
getAdminLogger
public org.apache.commons.logging.Log getAdminLogger()- Specified by:
getAdminLoggerin interfaceInternalAdmin
-
getGroups
Description copied from interface:AdminReturns the lookup groups this admin uses. -
getLocators
Description copied from interface:AdminReturns the lookup locators this admin uses.- Specified by:
getLocatorsin interfaceAdmin- See Also:
-
getDriver
- Specified by:
getDriverin interfaceInternalAdmin
-
getHorizontalScaleScheduledExecutorService
-
waitForDriver
- Specified by:
waitForDriverin interfaceInternalAdmin
-
initManagerClusterInfo
- Specified by:
initManagerClusterInfoin interfaceInternalAdmin
-
executeScaleThread
protected void executeScaleThread() -
getDriverIfActive
- Throws:
UnknownHostException
-
getManagerClusterInfo
Description copied from interface:AdminReturns the cluster manager information (if not initialized yet - return null)- Specified by:
getManagerClusterInfoin interfaceAdmin- See Also:
-
waitForManagerClusterInfo
Description copied from interface:AdminWaits indefinitely for the cluster manager information to be initialized, then return it- Specified by:
waitForManagerClusterInfoin interfaceAdmin
-
waitForManagerClusterInfo
Description copied from interface:AdminWaits for the specified timeout for the cluster manager information to be initialized, then return it. If the timeout elapses before initialization - return null.- Specified by:
waitForManagerClusterInfoin interfaceAdmin
-
login
- Specified by:
loginin interfaceInternalAdmin- Throws:
SecurityExceptionRemoteException
-
setCredentialsProvider
-
getCredentialsProvider
- Specified by:
getCredentialsProviderin interfaceInternalAdmin- Since:
- 12.1
-
getAttributeStore
public org.openspaces.zookeeper.attribute_store.ZooKeeperAttributeStore getAttributeStore()- Specified by:
getAttributeStorein interfaceInternalAdmin
-
getScaleManager
- Specified by:
getScaleManagerin interfaceInternalAdmin
-
getScaleVerticalManager
- Specified by:
getScaleVerticalManagerin interfaceInternalAdmin
-
addGroup
-
addLocator
-
setStatisticsInterval
Description copied from interface:StatisticsMonitorSets the statistics interval, automatically updating the monitoring scheduled tasks if monitoring is enabled.- Specified by:
setStatisticsIntervalin interfaceStatisticsMonitor
-
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
-
begin
public void begin() -
setProcessingUnitMonitorInterval
Description copied from interface:AdminSets the processing unit monitor (not statistics) interval. The monitor basically checks the status of each processing unit (ProcessingUnit.getStatus()among other things.Defaults to 1 second.
- Specified by:
setProcessingUnitMonitorIntervalin interfaceAdmin- Parameters:
interval- The interval to use.timeUnit- The time unit the interval is at.
-
setAgentProcessessMonitorInterval
Description copied from interface:AdminSets the Grid Service Agent processes monitor (not statistics) interval. The monitor basically updates the list of processes the agent manages (GridServiceAgent.getProcessesDetails().Defaults to 5 seconds.
- Specified by:
setAgentProcessessMonitorIntervalin interfaceAdmin- Parameters:
interval- The interval to use.timeUnit- The time unit the interval is at.
-
getScheduledSpaceMonitorInterval
public long getScheduledSpaceMonitorInterval()- Specified by:
getScheduledSpaceMonitorIntervalin interfaceInternalAdmin
-
getDefaultTimeout
public long getDefaultTimeout()- Specified by:
getDefaultTimeoutin interfaceInternalAdmin
-
getDefaultTimeoutTimeUnit
- Specified by:
getDefaultTimeoutTimeUnitin interfaceInternalAdmin
-
getDiscoveryService
-
setSpaceMonitorInterval
Description copied from interface:AdminSets the Space monitor (not statistics) interval. The monitor checks each space instance and updates its different status (such as the replication status).Defaults to 1 second.
- Specified by:
setSpaceMonitorIntervalin interfaceAdmin- Parameters:
interval- The interval to use.timeUnit- The time unit the interval is at.
-
getScheduler
- Specified by:
getSchedulerin interfaceInternalAdmin
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) - Specified by:
scheduleWithFixedDelayin interfaceInternalAdmin
-
setSchedulerCorePoolSize
public void setSchedulerCorePoolSize(int coreThreads) Description copied from interface:AdminThe Admin API uses a shared scheduler thread pool to perform *all* scheduled operations (monitoring, statistics monitoring). The number of threads used can be set here.Defaults to 10 threads.
- Specified by:
setSchedulerCorePoolSizein interfaceAdmin- Parameters:
coreThreads- The number of threads the shared scheduler thread pool will use,
-
setDefaultTimeout
Description copied from interface:AdminThe default timeout to be used for operations that have a wait for mechanism, i.e. operations with overloaded methods containing (..., long timeout, TimeUnit timeUnit). If not set, the default is Long.MAX_VALUE, TimeUnit.MILLISECONDS- Specified by:
setDefaultTimeoutin interfaceAdmin- Parameters:
timeout- The timeout value to be used as the default operation timeout if non was provided.timeUnit- The time-unit corresponding to the timeout.
-
close
public void close()Description copied from interface:AdminCloses the Admin, releasing any resource and stops listening for events from the lookup service. -
getLookupServices
Description copied from interface:AdminReturns the lookup services discovered.- Specified by:
getLookupServicesin interfaceAdmin
-
getGridServiceAgents
Description copied from interface:AdminReturns the grid service agents discovered.- Specified by:
getGridServiceAgentsin interfaceAdmin
-
getGridServiceManagers
Description copied from interface:AdminReturns the grid service managers discovered.- Specified by:
getGridServiceManagersin interfaceAdmin
-
getGridServiceContainers
Description copied from interface:AdminReturns the grid service containers discovered.- Specified by:
getGridServiceContainersin interfaceAdmin
-
getGateways
Description copied from interface:AdminReturns the gateways discovered.- Specified by:
getGatewaysin interfaceAdmin
-
getGridComponentByUID
Description copied from interface:AdminReturns the Grid Component represented by this UID; e.g. ESM, GSA, LUS, GSM, GSC- Specified by:
getGridComponentByUIDin interfaceAdmin- Parameters:
uid- The UID of the service returned byGridComponent.getUid();nullif no representation.- Returns:
- The Grid Component represented by this UID.
- See Also:
-
getMachines
Description copied from interface:AdminReturns the machines discovered.- Specified by:
getMachinesin interfaceAdmin
-
getZones
Description copied from interface:AdminReturns the zones discovered. -
getApplications
- Specified by:
getApplicationsin interfaceAdmin- Returns:
- the discovered applications
-
getTransports
Description copied from interface:AdminReturns the transports discovered.- Specified by:
getTransportsin interfaceAdmin
-
getVirtualMachines
Description copied from interface:AdminReturns the Virtual Machines discovered.- Specified by:
getVirtualMachinesin interfaceAdmin
-
getOperatingSystems
Description copied from interface:AdminReturns the Operating Systems discovered.- Specified by:
getOperatingSystemsin interfaceAdmin
-
getProcessingUnits
Description copied from interface:AdminReturns the Processing Units discovered.- Specified by:
getProcessingUnitsin interfaceAdmin
-
getGatewayProcessingUnits
Description copied from interface:AdminReturns the Gateway Processing Units discovered.- Specified by:
getGatewayProcessingUnitsin interfaceAdmin
-
getSpaces
Description copied from interface:AdminReturns the spaces discovered. -
getAlertManager
Description copied from interface:AdminReturns the alert manager through which alert strategies are managed, alerts are fired and alert events are registered for.- Specified by:
getAlertManagerin interfaceAdmin
-
addEventListener
Description copied from interface:AdminSmart addition of event listeners. Will automatically add to the correct place any interface that extends theAdminEventListenerinterface.- Specified by:
addEventListenerin interfaceAdmin- See Also:
-
addEventListener
Description copied from interface:AdminSmart addition of event listeners. Will automatically add to the correct place any interface that extends theAdminEventListenerinterface.- Specified by:
addEventListenerin interfaceAdminwithStatisticsHistory- if all statistics histories will be fired on registration statistics listener- See Also:
-
removeEventListener
Description copied from interface:AdminSmart removal of event listeners. Will automatically remove to the correct place any interface that extends theAdminEventListenerinterface.- Specified by:
removeEventListenerin interfaceAdmin- See Also:
-
getEventListenersCount
public int getEventListenersCount()Description copied from interface:AdminReturns number of registered event listeners. SeeAdminEventListener. Only for calls issued by either addEventListener or removeEventListener- Specified by:
getEventListenersCountin interfaceAdmin- See Also:
-
pushEvent
- Specified by:
pushEventin interfaceInternalAdmin
-
pushEventAsFirst
- Specified by:
pushEventAsFirstin interfaceInternalAdmin
-
flushEvents
public void flushEvents() -
raiseEvent
- Specified by:
raiseEventin interfaceInternalAdmin
-
scheduleNonBlockingStateChange
Description copied from interface:InternalAdminAny internal admin objects state change must be scheduled using this method. In case there is a single event loop thread (non blocking event listeners), the specified runnable is added to the event loop queue. Otherwise it is executed on the calling thread.- Specified by:
scheduleNonBlockingStateChangein interfaceInternalAdmin
-
scheduleAdminOperation
Description copied from interface:InternalAdminA generic thread pool for network based operations such as creating a new grid service container.- Specified by:
scheduleAdminOperationin interfaceInternalAdmin
-
assertStateChangesPermitted
public void assertStateChangesPermitted()- Specified by:
assertStateChangesPermittedin interfaceInternalAdmin
-
addGridServiceAgent
public void addGridServiceAgent(InternalGridServiceAgent gridServiceAgent, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) - Specified by:
addGridServiceAgentin interfaceInternalAdmin
-
removeGridServiceAgent
- Specified by:
removeGridServiceAgentin interfaceInternalAdmin
-
addLookupService
public void addLookupService(InternalLookupService lookupService, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) - Specified by:
addLookupServicein interfaceInternalAdmin
-
removeLookupService
- Specified by:
removeLookupServicein interfaceInternalAdmin
-
addGridServiceManager
public void addGridServiceManager(InternalGridServiceManager gridServiceManager, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones, boolean acceptVM) - Specified by:
addGridServiceManagerin interfaceInternalAdmin
-
removeGridServiceManager
- Specified by:
removeGridServiceManagerin interfaceInternalAdmin
-
addGridServiceContainer
public void addGridServiceContainer(InternalGridServiceContainer gridServiceContainer, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) - Specified by:
addGridServiceContainerin interfaceInternalAdmin
-
removeGridServiceContainer
- Specified by:
removeGridServiceContainerin interfaceInternalAdmin
-
addProcessingUnitInstance
public void addProcessingUnitInstance(InternalProcessingUnitInstance processingUnitInstance, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) - Specified by:
addProcessingUnitInstancein interfaceInternalAdmin
-
removeProcessingUnitInstance
- Specified by:
removeProcessingUnitInstancein interfaceInternalAdmin
-
addSpaceInstance
public void addSpaceInstance(InternalSpaceInstance spaceInstance, NIODetails nioDetails, OSDetails osDetails, JVMDetails jvmDetails, String jmxUrl, String[] zones) - Specified by:
addSpaceInstancein interfaceInternalAdmin
-
removeSpaceInstance
- Specified by:
removeSpaceInstancein interfaceInternalAdmin
-
generateDump
public DumpResult generateDump(Set<DumpProvider> dumpProviders, DumpGeneratedListener listener, String cause, Map<String, Object> context, String... processor) throws AdminExceptionDescription copied from interface:AdminGenerates dump for an explicit set of dump providers.- Specified by:
generateDumpin interfaceAdmin- Throws:
AdminException
-
generateDump
Description copied from interface:DumpProviderGenerates dump for all the provided dump processors. Note, this will include a heap dump which can consume time and potentially be of very large size- Specified by:
generateDumpin interfaceDumpProvider- Parameters:
cause- The cause that this dump was generatedcontext- Allows to provide specific parameters to specific processors- Throws:
AdminException
-
generateDump
public DumpResult generateDump(String cause, Map<String, Object> context, String... processor) throws AdminExceptionDescription copied from interface:DumpProviderGenerates dump for the provided processors. The current list of processors include:- summary: General summary information of the process.
- network: Information on the network layer of the process and the OS network stats.
- thread: Thread dump of the process.
- heap: Heap dump of the process. Note, this is a heavy operation and can produce very large dump files
- log: Adds all the log files of the process to the dump file.
- processingUnits: Dump of all the processing units (applicable only for GSCs) information.
- Specified by:
generateDumpin interfaceDumpProvider- Parameters:
cause- The cause this dump was generated.context- Allows to provide specific parameters to specific processors.processor- The list of processors to be used.- Throws:
AdminException
-
scheduleWithFixedDelayNonBlockingStateChange
public ScheduledFuture<?> scheduleWithFixedDelayNonBlockingStateChange(Runnable command, long initialDelay, long delay, TimeUnit unit) Description copied from interface:InternalAdminAny internal admin objects state change based on polling must be scheduled using this method. In case there is a single event loop thread (non blocking event listeners), the specified command is added to the event loop queue. Otherwise it is executed on the admin scheduler thread pool.- Specified by:
scheduleWithFixedDelayNonBlockingStateChangein interfaceInternalAdmin
-
scheduleOneTimeWithDelayNonBlockingStateChange
public ScheduledFuture<?> scheduleOneTimeWithDelayNonBlockingStateChange(Runnable command, long delay, TimeUnit unit) Description copied from interface:InternalAdminAny internal delayed admin objects state change based on polling must be scheduled using this method. In case there is a single event loop thread (non blocking event listeners), the specified command is added to the event loop queue. Otherwise it is executed on the admin scheduler thread pool.- Specified by:
scheduleOneTimeWithDelayNonBlockingStateChangein interfaceInternalAdmin
-
isSingleThreadedEventListeners
public boolean isSingleThreadedEventListeners()- Specified by:
isSingleThreadedEventListenersin interfaceInternalAdmin
-
setAdminFilter
- Parameters:
adminFilter-
-
getAdminFilter
- Specified by:
getAdminFilterin interfaceInternalAdmin
-
addGatewayProcessingUnit
- Specified by:
addGatewayProcessingUnitin interfaceInternalAdmin
-
removeGatewayProcessingUnit
- Specified by:
removeGatewayProcessingUnitin interfaceInternalAdmin
-
getOrphanProcessingUnitInstances
- Specified by:
getOrphanProcessingUnitInstancesin interfaceInternalAdmin
-
setDiscoveryServices
Set the service types that will be monitored Supported types:GridServiceAgent,GridServiceManager,GridServiceContainer,ProcessingUnit,Space- Throws:
IllegalArgumentException- if other type is provided
-