use of javax.management.openmbean.TabularDataSupport in project geode by apache.
the class TableConverter method toNonNullOpenValue.
Object toNonNullOpenValue(Object value) throws OpenDataException {
final Map<Object, Object> valueMap = (Map<Object, Object>) value;
if (valueMap instanceof SortedMap) {
Comparator comparator = ((SortedMap) valueMap).comparator();
if (comparator != null) {
final String msg = "Cannot convert SortedMap with non-null comparator: " + comparator;
IllegalArgumentException iae = new IllegalArgumentException(msg);
OpenDataException ode = new OpenDataException(msg);
ode.initCause(iae);
throw ode;
}
}
final TabularType tabularType = (TabularType) getOpenType();
final TabularData table = new TabularDataSupport(tabularType);
final CompositeType rowType = tabularType.getRowType();
for (Map.Entry entry : valueMap.entrySet()) {
final Object openKey = keyConverter.toOpenValue(entry.getKey());
final Object openValue = valueConverter.toOpenValue(entry.getValue());
final CompositeData row;
row = new CompositeDataSupport(rowType, keyValueArray, new Object[] { openKey, openValue });
table.put(row);
}
return table;
}
use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.
the class BlobGC method getGlobalMarkStats.
@Override
public TabularData getGlobalMarkStats() {
TabularDataSupport tds;
try {
TabularType tt = new TabularType(BlobGC.class.getName(), "Garbage collection global mark phase Stats", TYPE, new String[] { "repositoryId" });
tds = new TabularDataSupport(tt);
List<GarbageCollectionRepoStats> stats = blobGarbageCollector.getStats();
for (GarbageCollectionRepoStats stat : stats) {
tds.put(toCompositeData(stat));
}
} catch (Exception e) {
throw new IllegalStateException(e);
}
return tds;
}
use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.
the class ConsolidatedListenerMBeanImpl method getObserversStats.
@Override
public TabularData getObserversStats() {
TabularDataSupport tds;
try {
int id = 0;
TabularType tt = new TabularType(ObserverStatsData.class.getName(), "Consolidated Observer Stats", ObserverStatsData.TYPE, new String[] { "index" });
tds = new TabularDataSupport(tt);
for (BackgroundObserverMBean o : collectNonJcrObservers()) {
tds.put(new ObserverStatsData(++id, o).toCompositeData());
}
} catch (OpenDataException e) {
throw new IllegalStateException(e);
}
return tds;
}
use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.
the class IndexCopier method getIndexPathMapping.
//~------------------------------------------< CopyOnReadStatsMBean >
@Override
public TabularData getIndexPathMapping() {
TabularDataSupport tds;
try {
TabularType tt = new TabularType(IndexMappingData.class.getName(), "Lucene Index Stats", IndexMappingData.TYPE, new String[] { "jcrPath" });
tds = new TabularDataSupport(tt);
for (LocalIndexDir indexDir : indexRootDirectory.getAllLocalIndexes()) {
String size = humanReadableByteCount(indexDir.size());
tds.put(new CompositeDataSupport(IndexMappingData.TYPE, IndexMappingData.FIELD_NAMES, new String[] { indexDir.getJcrPath(), indexDir.getFSPath(), size }));
}
} catch (OpenDataException e) {
throw new IllegalStateException(e);
} catch (IOException e) {
throw new IllegalStateException(e);
}
return tds;
}
use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.
the class LuceneIndexMBeanImpl method getIndexStats.
@Override
public TabularData getIndexStats() throws IOException {
TabularDataSupport tds;
try {
TabularType tt = new TabularType(LuceneIndexMBeanImpl.class.getName(), "Lucene Index Stats", IndexStats.TYPE, new String[] { "path" });
tds = new TabularDataSupport(tt);
Set<String> indexes = indexTracker.getIndexNodePaths();
for (String path : indexes) {
IndexNode indexNode = null;
try {
indexNode = indexTracker.acquireIndexNode(path);
if (indexNode != null) {
IndexStats stats = new IndexStats(path, indexNode);
tds.put(stats.toCompositeData());
}
} finally {
if (indexNode != null) {
indexNode.release();
}
}
}
} catch (OpenDataException e) {
throw new IllegalStateException(e);
}
return tds;
}
Aggregations