use of org.apache.geode.Statistics in project geode by apache.
the class FetchStatsResponse method create.
/**
* Generate a complete response to request for stats.
*
* @param dm DistributionManager that is responding
* @param recipient the recipient who made the original request
* @return response containing all remote stat resources
*/
public static FetchStatsResponse create(DistributionManager dm, InternalDistributedMember recipient, final String statisticsTypeName) {
// LogWriterI18n log = dm.getLogger();
FetchStatsResponse m = new FetchStatsResponse();
m.setRecipient(recipient);
final List<RemoteStatResource> statList = new ArrayList<RemoteStatResource>();
// call visitStatistics to fix for bug 40358
if (statisticsTypeName == null) {
dm.getSystem().visitStatistics(new StatisticsVisitor() {
public void visit(Statistics s) {
statList.add(new RemoteStatResource(s));
}
});
} else {
dm.getSystem().visitStatistics(new StatisticsVisitor() {
public void visit(Statistics s) {
if (s.getType().getName().equals(statisticsTypeName)) {
statList.add(new RemoteStatResource(s));
}
}
});
}
m.stats = new RemoteStatResource[statList.size()];
m.stats = (RemoteStatResource[]) statList.toArray(m.stats);
return m;
}
use of org.apache.geode.Statistics in project geode by apache.
the class InternalDistributedSystem method findStatisticsByType.
public Statistics[] findStatisticsByType(final StatisticsType type) {
final ArrayList hits = new ArrayList();
visitStatistics(new StatisticsVisitor() {
public void visit(Statistics s) {
if (type == s.getType()) {
hits.add(s);
}
}
});
Statistics[] result = new Statistics[hits.size()];
return (Statistics[]) hits.toArray(result);
}
use of org.apache.geode.Statistics in project geode by apache.
the class AbstractStatisticsFactory method findStatisticsByType.
@Override
public Statistics[] findStatisticsByType(StatisticsType type) {
List<Statistics> hits = new ArrayList<Statistics>();
Iterator<Statistics> it = statsList.iterator();
while (it.hasNext()) {
Statistics s = (Statistics) it.next();
if (type == s.getType()) {
hits.add(s);
}
}
Statistics[] result = new Statistics[hits.size()];
return (Statistics[]) hits.toArray(result);
}
use of org.apache.geode.Statistics in project geode by apache.
the class AbstractStatisticsFactory method findStatisticsByNumericId.
@Override
public Statistics[] findStatisticsByNumericId(long numericId) {
List<Statistics> hits = new ArrayList<Statistics>();
Iterator<Statistics> it = statsList.iterator();
while (it.hasNext()) {
Statistics s = (Statistics) it.next();
if (numericId == s.getNumericId()) {
hits.add(s);
}
}
Statistics[] result = new Statistics[hits.size()];
return (Statistics[]) hits.toArray(result);
}
use of org.apache.geode.Statistics in project geode by apache.
the class AbstractStatisticsFactory method createAtomicStatistics.
@Override
public Statistics createAtomicStatistics(StatisticsType type, String textId, long numericId) {
long myUniqueId;
synchronized (statsListUniqueIdLock) {
// fix for bug 30597
myUniqueId = statsListUniqueId++;
}
Statistics result = StatisticsImpl.createAtomicNoOS(type, textId, numericId, myUniqueId, this);
synchronized (statsList) {
statsList.add(result);
statsListModCount++;
}
return result;
}
Aggregations