use of org.apache.geode.Statistics in project geode by apache.
the class AggregateRegionStatsMonitor method stopListener.
@Override
public void stopListener() {
for (Statistics stat : listeners.keySet()) {
ValueMonitor monitor = monitors.get(stat);
monitor.removeListener(listeners.get(stat));
monitor.removeStatistics(stat);
}
listeners.clear();
monitors.clear();
}
use of org.apache.geode.Statistics in project geode by apache.
the class MemberMBeanBridge method addVMStats.
public void addVMStats() {
VMStatsContract vmStatsContract = system.getStatSampler().getVMStats();
if (vmStatsContract != null && vmStatsContract instanceof VMStats50) {
VMStats50 vmStats50 = (VMStats50) vmStatsContract;
Statistics vmStats = vmStats50.getVMStats();
if (vmStats != null) {
vmStatsMonitor.addStatisticsToMonitor(vmStats);
}
Statistics vmHeapStats = vmStats50.getVMHeapStats();
if (vmHeapStats != null) {
vmStatsMonitor.addStatisticsToMonitor(vmHeapStats);
}
StatisticsType gcType = VMStats50.getGCType();
if (gcType != null) {
Statistics[] gcStats = system.findStatisticsByType(gcType);
if (gcStats != null && gcStats.length > 0) {
for (Statistics gcStat : gcStats) {
if (gcStat != null) {
gcMonitor.addStatisticsToMonitor(gcStat);
}
}
}
}
}
}
use of org.apache.geode.Statistics in project geode by apache.
the class MemberMBeanBridge method addOffHeapStats.
public void addOffHeapStats(OffHeapMemoryStats offHeapStats) {
Statistics offHeapMemoryStatistics = offHeapStats.getStats();
monitor.addStatisticsToMonitor(offHeapMemoryStatistics);
}
use of org.apache.geode.Statistics in project geode by apache.
the class VMStats50 method refreshGC.
private void refreshGC() {
Iterator<Map.Entry<GarbageCollectorMXBean, Statistics>> it = gcMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<GarbageCollectorMXBean, Statistics> me = it.next();
GarbageCollectorMXBean gc = me.getKey();
Statistics s = me.getValue();
if (!gc.isValid()) {
s.close();
it.remove();
} else {
s.setLong(gc_collectionsId, gc.getCollectionCount());
s.setLong(gc_collectionTimeId, gc.getCollectionTime());
}
}
}
use of org.apache.geode.Statistics in project geode by apache.
the class VMStats50 method refreshMemoryPools.
private void refreshMemoryPools() {
boolean reInitPools = false;
Iterator<Map.Entry<MemoryPoolMXBean, Statistics>> it = mpMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<MemoryPoolMXBean, Statistics> me = it.next();
MemoryPoolMXBean mp = me.getKey();
Statistics s = me.getValue();
if (!mp.isValid()) {
s.close();
it.remove();
reInitPools = true;
} else {
MemoryUsage mu = null;
try {
mu = mp.getUsage();
} catch (IllegalArgumentException ex) {
// to workaround JRockit bug 36348 just ignore this and try the next pool
continue;
} catch (InternalError ie) {
// Somebody saw an InternalError once but I have no idea how to reproduce it. Was this a
// race between
// mp.isValid() and mp.getUsage()? Perhaps.
s.close();
it.remove();
reInitPools = true;
logger.warn("Accessing MemoryPool '{}' threw an Internal Error: {}", mp.getName(), ie.getMessage());
continue;
}
s.setLong(mp_l_initMemoryId, mu.getInit());
s.setLong(mp_l_usedMemoryId, mu.getUsed());
s.setLong(mp_l_committedMemoryId, mu.getCommitted());
s.setLong(mp_l_maxMemoryId, mu.getMax());
if (mp.isUsageThresholdSupported()) {
s.setLong(mp_usageThresholdId, mp.getUsageThreshold());
s.setLong(mp_usageExceededId, mp.getUsageThresholdCount());
}
mu = null;
if (!this.isCollectionUsageUnsupported(mp)) {
try {
mu = mp.getCollectionUsage();
} catch (UnsupportedOperationException ex) {
// JRockit throws this exception instead of returning null
// as the javadocs say it should. See bug 36348
this.setCollectionUsageUnsupported(mp);
} catch (IllegalArgumentException ex) {
// Yet another JRockit bug in which its code catches an assertion
// about the state of their bean stat values being inconsistent.
// See bug 36348.
this.setCollectionUsageUnsupported(mp);
}
}
if (mu != null) {
// s.setLong(mp_gc_initMemoryId, mu.getInit());
s.setLong(mp_gc_usedMemoryId, mu.getUsed());
// s.setLong(mp_gc_maxMemoryId, mu.getMax());
if (mp.isCollectionUsageThresholdSupported()) {
s.setLong(mp_collectionUsageThresholdId, mp.getCollectionUsageThreshold());
s.setLong(mp_collectionUsageExceededId, mp.getCollectionUsageThresholdCount());
}
}
}
}
if (reInitPools) {
initMemoryPools();
}
}
Aggregations