use of javax.management.openmbean.OpenDataException in project jackrabbit-oak by apache.
the class LuceneIndexMBeanImpl method getBadIndexStats.
@Override
public TabularData getBadIndexStats() {
TabularDataSupport tds;
try {
TabularType tt = new TabularType(LuceneIndexMBeanImpl.class.getName(), "Lucene Bad Index Stats", BadIndexStats.TYPE, new String[] { "path" });
tds = new TabularDataSupport(tt);
Set<String> indexes = indexTracker.getBadIndexTracker().getIndexPaths();
for (String path : indexes) {
BadIndexInfo info = indexTracker.getBadIndexTracker().getInfo(path);
if (info != null) {
BadIndexStats stats = new BadIndexStats(info);
tds.put(stats.toCompositeData());
}
}
} catch (OpenDataException e) {
throw new IllegalStateException(e);
}
return tds;
}
use of javax.management.openmbean.OpenDataException in project karaf by apache.
the class PackagesMBeanImpl method getImports.
@Override
public TabularData getImports() {
try {
String[] names = new String[] { "PackageName", "Filter", "Optional", "ID", "Bundle Name", "Resolvable" };
CompositeType bundleType = new CompositeType("PackageImports", "Imported packages", names, names, new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.LONG, SimpleType.STRING, SimpleType.BOOLEAN });
TabularType tableType = new TabularType("PackageImports", "Imported packages", bundleType, new String[] { "Filter", "ID" });
TabularData table = new TabularDataSupport(tableType);
List<PackageRequirement> imports = packageService.getImports();
for (PackageRequirement req : imports) {
Object[] data = new Object[] { req.getPackageName(), req.getFilter(), req.isOptional(), req.getBundle().getBundleId(), req.getBundle().getSymbolicName(), req.isResolveable() };
CompositeData comp = new CompositeDataSupport(bundleType, names, data);
try {
table.put(comp);
} catch (KeyAlreadyExistsException e) {
throw new RuntimeException("Id: " + req.getBundle().getBundleId() + ", filter: " + req.getFilter(), e);
}
}
return table;
} catch (RuntimeException e) {
// To avoid the exception gets swallowed by jmx
LOGGER.error(e.getMessage(), e);
throw e;
} catch (OpenDataException e) {
LOGGER.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
use of javax.management.openmbean.OpenDataException in project karaf by apache.
the class JmxReference method createReferenceType.
private static CompositeType createReferenceType() {
try {
String description = "This type encapsulates Scr references";
String[] itemNames = ScrServiceMBean.REFERENCE;
OpenType[] itemTypes = new OpenType[itemNames.length];
String[] itemDescriptions = new String[itemNames.length];
itemTypes[0] = SimpleType.STRING;
itemTypes[1] = SimpleType.BOOLEAN;
itemTypes[2] = SimpleType.STRING;
itemTypes[3] = SimpleType.STRING;
itemTypes[4] = SimpleType.STRING;
itemTypes[5] = new ArrayType(1, SimpleType.STRING);
itemDescriptions[0] = "The name of the reference";
itemDescriptions[1] = "The state of the reference";
itemDescriptions[2] = "The cardinality of the reference";
itemDescriptions[3] = "The availability of the reference";
itemDescriptions[4] = "The policy of the reference";
itemDescriptions[5] = "The bound services";
return new CompositeType("Reference", description, itemNames, itemDescriptions, itemTypes);
} catch (OpenDataException e) {
throw new IllegalStateException("Unable to build reference type", e);
}
}
use of javax.management.openmbean.OpenDataException in project jdk8u_jdk by JetBrains.
the class MonitorInfoCompositeData method getCompositeData.
protected CompositeData getCompositeData() {
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// monitorInfoItemNames!
int len = monitorInfoItemNames.length;
Object[] values = new Object[len];
CompositeData li = LockInfoCompositeData.toCompositeData(lock);
for (int i = 0; i < len; i++) {
String item = monitorInfoItemNames[i];
if (item.equals(LOCKED_STACK_FRAME)) {
StackTraceElement ste = lock.getLockedStackFrame();
values[i] = (ste != null ? StackTraceElementCompositeData.toCompositeData(ste) : null);
} else if (item.equals(LOCKED_STACK_DEPTH)) {
values[i] = new Integer(lock.getLockedStackDepth());
} else {
values[i] = li.get(item);
}
}
try {
return new CompositeDataSupport(monitorInfoCompositeType, monitorInfoItemNames, values);
} catch (OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
}
}
use of javax.management.openmbean.OpenDataException in project jdk8u_jdk by JetBrains.
the class GarbageCollectionNotifInfoCompositeData method getBaseGcNotifInfoCompositeType.
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
if (baseGcNotifInfoCompositeType == null) {
try {
OpenType<?>[] baseGcNotifInfoItemTypes = new OpenType<?>[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, GcInfoCompositeData.getBaseGcInfoCompositeType() };
baseGcNotifInfoCompositeType = new CompositeType("sun.management.BaseGarbageCollectionNotifInfoCompositeType", "CompositeType for Base GarbageCollectionNotificationInfo", gcNotifInfoItemNames, gcNotifInfoItemNames, baseGcNotifInfoItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
}
return baseGcNotifInfoCompositeType;
}
Aggregations