use of com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider in project Payara by payara.
the class GrizzlyMonitoring method updateGlobalThreadPoolStatsProvider.
/**
* Updates the global thread pool stats provider with the most current
* total values.
*/
public void updateGlobalThreadPoolStatsProvider() {
final ThreadPoolStatsProvider globalThreadPoolStatsProvider = threadPoolStatsProvidersMap.get("");
// Exit method if global stats provider not registered
if (globalThreadPoolStatsProvider == null) {
return;
}
int coreThreadTotal = 0;
int maxThreadTotal = 0;
// Calculate the totals for each of the metrics
for (Map.Entry<String, ThreadPoolStatsProvider> threadPoolStatsProvider : threadPoolStatsProvidersMap.entrySet()) {
if (!threadPoolStatsProvider.getKey().equals("")) {
// Get the pool config so we can check the thread pool name
ThreadPoolConfig threadPoolConfig = (ThreadPoolConfig) threadPoolStatsProvider.getValue().getStatsObject();
if (threadPoolConfig != null) {
// Safe to cast from long to int, as the values cannot
// actually be higher than max int.
coreThreadTotal += (int) (long) threadPoolStatsProvider.getValue().getCoreThreadsCount().getCount();
maxThreadTotal += (int) (long) threadPoolStatsProvider.getValue().getMaxThreadsCount().getCount();
}
}
}
// Now that we've calculated the global core and max values, set them
globalThreadPoolStatsProvider.setCoreThreadsEvent("", coreThreadTotal);
globalThreadPoolStatsProvider.setMaxThreadsEvent("", maxThreadTotal);
}
use of com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider in project Payara by payara.
the class GrizzlyMonitoring method registerThreadPoolStatsProvider.
/**
* Register thread-pool statistics provider for a network listener
*
* @param name network listener name
*/
public void registerThreadPoolStatsProvider(String name) {
ThreadPoolStatsProvider threadPoolStatsProvider = new ThreadPoolStatsProvider(name);
ThreadPoolStatsProvider oldthreadPoolStatsProvider = threadPoolStatsProvidersMap.put(name, threadPoolStatsProvider);
if (oldthreadPoolStatsProvider != null) {
StatsProviderManager.unregister(oldthreadPoolStatsProvider);
}
StatsProviderManager.register(CONFIG_ELEMENT, PluginPoint.SERVER, subtreePrefix(name) + "/thread-pool", threadPoolStatsProvider);
}
use of com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider in project Payara by payara.
the class GrizzlyMonitoring method registerThreadPoolStatsProviderGlobal.
/**
* Register server wide thread-pool statistics provider
*/
public void registerThreadPoolStatsProviderGlobal(String name) {
ThreadPoolStatsProvider threadPoolStatsProvider = new ThreadPoolStatsProviderGlobal(name);
ThreadPoolStatsProvider oldthreadPoolStatsProvider = threadPoolStatsProvidersMap.put(name, threadPoolStatsProvider);
if (oldthreadPoolStatsProvider != null) {
StatsProviderManager.unregister(oldthreadPoolStatsProvider);
}
StatsProviderManager.register(CONFIG_ELEMENT, PluginPoint.SERVER, subtreePrefix(name) + "/global-thread-pool-stats", threadPoolStatsProvider);
updateGlobalThreadPoolStatsProvider();
}
use of com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider in project Payara by payara.
the class GrizzlyMonitoring method unregisterThreadPoolStatsProvider.
/**
* Unregister thread-pool statistics provider for a network listener
*
* @param name network listener name
*/
public void unregisterThreadPoolStatsProvider(String name) {
final ThreadPoolStatsProvider threadPoolStatsProvider = threadPoolStatsProvidersMap.remove(name);
if (threadPoolStatsProvider != null) {
// Unregister it from the global thread pool stats provider
threadPoolStatsProvider.unregisterThreadPool(name);
StatsProviderManager.unregister(threadPoolStatsProvider);
updateGlobalThreadPoolStatsProvider();
}
}
Aggregations