use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class AttributeContentProvider method refresh.
/**
* Refreshes the content provider.
*
* @param jvm The JVM
* @param objectName The object name
* @throws JvmCoreException
*/
protected void refresh(IActiveJvm jvm, ObjectName objectName) throws JvmCoreException {
MBeanInfo mBeanInfo = null;
List<AttributeNode> nodes = new ArrayList<AttributeNode>();
try {
mBeanInfo = jvm.getMBeanServer().getMBeanInfo(objectName);
} catch (JvmCoreException e) {
attributeRootNodes = nodes;
throw e;
}
if (mBeanInfo == null) {
attributeRootNodes = nodes;
return;
}
AttributeParser parser = new AttributeParser();
for (MBeanAttributeInfo attributeInfo : mBeanInfo.getAttributes()) {
String name = attributeInfo.getName();
Object value = getAttributeValue(jvm, objectName, name);
AttributeNode attributeNode = null;
for (AttributeNode node : attributeRootNodes) {
if (node.getName().equals(name)) {
attributeNode = node;
attributeNode.setValue(value);
break;
}
}
if (attributeNode == null) {
attributeNode = new AttributeNode(name, null, value);
}
parser.refreshAttribute(attributeNode);
attributeNode.setWritable(attributeInfo.isWritable());
nodes.add(attributeNode);
}
Collections.sort(nodes, new Comparator<AttributeNode>() {
@Override
public int compare(AttributeNode o1, AttributeNode o2) {
return o1.getName().compareTo(o2.getName());
}
});
attributeRootNodes = nodes;
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class SWTResourceMonitor method isSupported.
/*
* @see ISWTResourceMonitor#isSupported()
*/
@Override
public boolean isSupported() {
try {
ObjectName objectName = validateAgent();
if (objectName == null) {
return false;
}
Object attribute = jvm.getMBeanServer().getAttribute(objectName, TRACKING);
return attribute != null;
} catch (JvmCoreException e) {
return false;
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class Snapshot method rename.
/*
* @see ISnapshot#rename(String)
*/
@Override
public void rename(String newName) throws JvmCoreException {
File file = new File(fileStore.toURI());
String newFilePath = fileStore.getParent().toURI().getPath() + File.separator + newName;
File destFile = new File(newFilePath);
if (file.renameTo(destFile)) {
if (jvm instanceof AbstractJvm) {
((AbstractJvm) jvm).refreshSnapshots();
}
} else {
throw new JvmCoreException(IStatus.ERROR, NLS.bind(Messages.renameFileFailedMsg, fileStore.toURI().getPath()), null);
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class OverviewProperties method refreshPropertyValues.
/**
* Refreshes the property values.
*/
private void refreshPropertyValues() {
for (List<OverviewProperty> properties : overviewProperties.values()) {
for (OverviewProperty property : properties) {
try {
ObjectName objectName = ObjectName.getInstance(property.getObjectName());
String attributeName = property.getAttributeName();
Object attribute = activeJvm.getMBeanServer().getAttribute(objectName, attributeName);
property.setValue(attribute);
} catch (JvmCoreException e) {
Activator.log(Messages.getMBeanAttributeFailedMsg, e);
} catch (JMException e) {
Activator.log(IStatus.ERROR, Messages.getMBeanAttributeFailedMsg, e);
}
}
}
}
use of org.talend.designer.runtime.visualization.JvmCoreException in project tdi-studio-se by Talend.
the class OverviewProperties method addGarbageCollectionProperties.
/**
* Adds the garbage collection properties.
*/
private void addGarbageCollectionProperties() {
List<OverviewProperty> list = new ArrayList<OverviewProperty>();
try {
//$NON-NLS-1$
ObjectName queryObjectName = ObjectName.getInstance("java.lang:type=GarbageCollector,name=*");
Set<ObjectName> objectNames = activeJvm.getMBeanServer().queryNames(queryObjectName);
for (ObjectName objectName : objectNames) {
//$NON-NLS-1$
String name = objectName.getKeyProperty("name");
list.add(new OverviewProperty(OverviewCategory.GarbageCollector, NLS.bind(Messages.collectionCountLabel, name), "CollectionCount", name, null, //$NON-NLS-1$
true));
list.add(new OverviewProperty(OverviewCategory.GarbageCollector, NLS.bind(Messages.collectionTimeLabel, name), "CollectionTime", name, IFormat.MILLISEC_FORMAT, //$NON-NLS-1$
true));
}
} catch (MalformedObjectNameException e) {
Activator.log(IStatus.ERROR, Messages.getObjectNameFailedMsg, e);
} catch (JvmCoreException e) {
Activator.log(Messages.getObjectNameFailedMsg, e);
}
overviewProperties.put(OverviewCategory.GarbageCollector, list);
}
Aggregations