use of javax.management.openmbean.CompositeDataSupport in project jdk8u_jdk by JetBrains.
the class GarbageCollectionNotifInfoCompositeData method getCompositeData.
protected CompositeData getCompositeData() {
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// gcNotifInfoItemNames!
final Object[] gcNotifInfoItemValues;
gcNotifInfoItemValues = new Object[] { gcNotifInfo.getGcName(), gcNotifInfo.getGcAction(), gcNotifInfo.getGcCause(), GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo()) };
CompositeType gict = getCompositeTypeByBuilder();
try {
return new CompositeDataSupport(gict, gcNotifInfoItemNames, gcNotifInfoItemValues);
} catch (OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
}
}
use of javax.management.openmbean.CompositeDataSupport in project ddf by codice.
the class UndeliveredMessages method getMessages.
@Override
public List<CompositeData> getMessages(String address, String module) {
List<CompositeData> undeliveredMessages = new ArrayList<>();
Object compositeDatas = invokeMbean(createArtemisObjectName(address, module), GET_MESSAGES_OPERATION, new Object[] { "" }, new String[] { String.class.getName() });
if (!(compositeDatas instanceof CompositeData[])) {
return undeliveredMessages;
}
CompositeData[] messages = (CompositeData[]) compositeDatas;
for (CompositeData message : messages) {
Set<String> setMessageKeys = message.getCompositeType().keySet();
String[] messageKeysArray = setMessageKeys.toArray(new String[setMessageKeys.size()]);
Object[] messageValues = message.getAll(messageKeysArray);
CompositeType messageCompositeType = message.getCompositeType();
String[] itemDescription = new String[messageKeysArray.length];
OpenType<?>[] itemTypes = new OpenType[messageKeysArray.length];
try {
for (int i = 0; i < messageKeysArray.length; i++) {
String messageKey = messageKeysArray[i];
itemDescription[i] = messageCompositeType.getDescription(messageKey);
if (messageKeysArray[i].equals("body")) {
byte[] messageBodyBytes = (byte[]) message.get("body");
// Remove unprintable characters from the beginning of the string
messageValues[i] = removeNullCharacters(new String(Arrays.copyOfRange(messageBodyBytes, 5, messageBodyBytes.length), StandardCharsets.UTF_8));
itemTypes[i] = SimpleType.STRING;
} else {
itemTypes[i] = messageCompositeType.getType(messageKey);
}
}
undeliveredMessages.add(new CompositeDataSupport(new CompositeType(messageCompositeType.getTypeName(), messageCompositeType.getDescription(), messageKeysArray, itemDescription, itemTypes), messageKeysArray, messageValues));
} catch (OpenDataException e) {
LOGGER.warn("Unable to retrieve messages from the broker. For more information, set " + "logging level to DEBUG.");
LOGGER.debug("Unable to retrieve messages from the broker.", e);
}
}
return undeliveredMessages;
}
use of javax.management.openmbean.CompositeDataSupport in project hazelcast by hazelcast.
the class JVMUtil method isHotSpotCompressedOopsOrNull.
// not private for testing
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
static Boolean isHotSpotCompressedOopsOrNull() {
try {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName mbean = new ObjectName("com.sun.management:type=HotSpotDiagnostic");
Object[] objects = { "UseCompressedOops" };
String[] strings = { "java.lang.String" };
String operation = "getVMOption";
CompositeDataSupport compressedOopsValue = (CompositeDataSupport) server.invoke(mbean, operation, objects, strings);
return Boolean.valueOf(compressedOopsValue.get("value").toString());
} catch (Exception e) {
getLogger(JVMUtil.class).fine("Failed to read HotSpot specific configuration: " + e.getMessage());
}
return null;
}
use of javax.management.openmbean.CompositeDataSupport in project camel by apache.
the class ManagedAsyncProcessorAwaitManager method browse.
@Override
public TabularData browse() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listAwaitThreadsTabularType());
Collection<AsyncProcessorAwaitManager.AwaitThread> threads = manager.browse();
for (AsyncProcessorAwaitManager.AwaitThread entry : threads) {
CompositeType ct = CamelOpenMBeanTypes.listAwaitThreadsCompositeType();
String id = "" + entry.getBlockedThread().getId();
String name = entry.getBlockedThread().getName();
String exchangeId = entry.getExchange().getExchangeId();
String routeId = entry.getRouteId();
String nodeId = entry.getNodeId();
String duration = "" + entry.getWaitDuration();
CompositeData data = new CompositeDataSupport(ct, new String[] { "id", "name", "exchangeId", "routeId", "nodeId", "duration" }, new Object[] { id, name, exchangeId, routeId, nodeId, duration });
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
use of javax.management.openmbean.CompositeDataSupport in project camel by apache.
the class ManagedCamelContext method listEips.
public TabularData listEips() throws Exception {
try {
// find all EIPs
Map<String, Properties> eips = context.findEips();
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEipsTabularType());
// gather EIP detail for each eip
for (Map.Entry<String, Properties> entry : eips.entrySet()) {
String name = entry.getKey();
String title = (String) entry.getValue().get("title");
String description = (String) entry.getValue().get("description");
String label = (String) entry.getValue().get("label");
String type = (String) entry.getValue().get("class");
String status = CamelContextHelper.isEipInUse(context, name) ? "in use" : "on classpath";
CompositeType ct = CamelOpenMBeanTypes.listEipsCompositeType();
CompositeData data = new CompositeDataSupport(ct, new String[] { "name", "title", "description", "label", "status", "type" }, new Object[] { name, title, description, label, status, type });
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
Aggregations