use of javax.management.InstanceNotFoundException in project jdk8u_jdk by JetBrains.
the class XSheet method displayMBeanAttributesNode.
// Call on EDT
private void displayMBeanAttributesNode(final DefaultMutableTreeNode node) {
final XNodeInfo uo = (XNodeInfo) node.getUserObject();
if (!uo.getType().equals(Type.ATTRIBUTES)) {
return;
}
mbean = (XMBean) uo.getData();
final XMBean xmb = mbean;
SwingWorker<MBeanInfo, Void> sw = new SwingWorker<MBeanInfo, Void>() {
@Override
public MBeanInfo doInBackground() throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
MBeanInfo mbi = xmb.getMBeanInfo();
return mbi;
}
@Override
protected void done() {
try {
MBeanInfo mbi = get();
if (mbi != null && mbi.getAttributes() != null && mbi.getAttributes().length > 0) {
mbeanAttributes.loadAttributes(xmb, mbi);
if (!isSelectedNode(node, currentNode)) {
return;
}
invalidate();
mainPanel.removeAll();
JPanel borderPanel = new JPanel(new BorderLayout());
borderPanel.setBorder(BorderFactory.createTitledBorder(Messages.ATTRIBUTE_VALUES));
borderPanel.add(new JScrollPane(mbeanAttributes));
mainPanel.add(borderPanel, BorderLayout.CENTER);
// add the refresh button to the south panel
southPanel.removeAll();
southPanel.add(refreshButton, BorderLayout.SOUTH);
southPanel.setVisible(true);
refreshButton.setEnabled(true);
validate();
repaint();
}
} catch (Exception e) {
Throwable t = Utils.getActualException(e);
if (JConsole.isDebug()) {
System.err.println("Problem displaying MBean " + "attributes for MBean [" + mbean.getObjectName() + "]");
t.printStackTrace();
}
showErrorDialog(t.toString(), Messages.PROBLEM_DISPLAYING_MBEAN);
}
}
};
sw.execute();
}
use of javax.management.InstanceNotFoundException in project jdk8u_jdk by JetBrains.
the class XSheet method displayMBeanNode.
// Call on EDT
private void displayMBeanNode(final DefaultMutableTreeNode node) {
final XNodeInfo uo = (XNodeInfo) node.getUserObject();
if (!uo.getType().equals(Type.MBEAN)) {
return;
}
mbean = (XMBean) uo.getData();
SwingWorker<MBeanInfo, Void> sw = new SwingWorker<MBeanInfo, Void>() {
@Override
public MBeanInfo doInBackground() throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
return mbean.getMBeanInfo();
}
@Override
protected void done() {
try {
MBeanInfo mbi = get();
if (mbi != null) {
if (!isSelectedNode(node, currentNode)) {
return;
}
mbeanInfo.addMBeanInfo(mbean, mbi);
invalidate();
mainPanel.removeAll();
mainPanel.add(mbeanInfo, BorderLayout.CENTER);
southPanel.setVisible(false);
southPanel.removeAll();
validate();
repaint();
}
} catch (Exception e) {
Throwable t = Utils.getActualException(e);
if (JConsole.isDebug()) {
System.err.println("Couldn't get MBeanInfo for MBean [" + mbean.getObjectName() + "]");
t.printStackTrace();
}
showErrorDialog(t.toString(), Messages.PROBLEM_DISPLAYING_MBEAN);
}
}
};
sw.execute();
}
use of javax.management.InstanceNotFoundException in project jdk8u_jdk by JetBrains.
the class ScanManager method scanAllDirectories.
// ---------------------------------------------------------------
// We start scanning in background in a Timer thread.
// The methods below implement that logic.
// ---------------------------------------------------------------
private void scanAllDirectories() throws IOException, InstanceNotFoundException {
int errcount = 0;
final StringBuilder b = new StringBuilder();
for (ObjectName key : scanmap.keySet()) {
final DirectoryScannerMXBean s = scanmap.get(key);
try {
if (state == STOPPED)
return;
s.scan();
} catch (Exception ex) {
LOG.log(Level.FINE, key + " failed to scan: " + ex, ex);
errcount++;
append(b, "\t", ex);
}
}
if (errcount > 0) {
b.insert(0, "scan partially performed with " + errcount + " error(s):");
throw new RuntimeException(b.toString());
}
}
use of javax.management.InstanceNotFoundException in project sling by apache.
the class DataSourceFactory method unregisterJmx.
private void unregisterJmx() {
try {
if (jmxName != null) {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.unregisterMBean(jmxName);
}
} catch (InstanceNotFoundException ignore) {
// NOOP
} catch (Exception e) {
log.error("Unable to unregister JDBC pool with JMX", e);
}
}
use of javax.management.InstanceNotFoundException in project sling by apache.
the class JMXResourceProvider method parse.
/**
* Parse the path
*/
private PathInfo parse(final String path) {
for (final String root : this.rootsWithSlash) {
if (path.startsWith(root)) {
final String subPath = path.substring(root.length());
if (subPath.length() == 0) {
return new PathInfo(true);
}
// MBean name / path
String checkPath = subPath;
String pathInfo = null;
ObjectName objectName = null;
MBeanInfo mbi = null;
while (checkPath.length() > 0 && mbi == null) {
try {
objectName = this.convertResourcePathToObjectName(checkPath);
if (objectName != null) {
mbi = this.mbeanServer.getMBeanInfo(objectName);
}
} catch (final IntrospectionException e) {
// ignore
} catch (final InstanceNotFoundException e) {
// ignore
} catch (final ReflectionException e) {
// ignore
}
if (mbi == null) {
final int sep = checkPath.lastIndexOf('/');
if (sep == -1) {
checkPath = "";
pathInfo = subPath;
} else {
checkPath = checkPath.substring(0, sep);
pathInfo = subPath.substring(sep + 1);
}
}
}
final PathInfo info = new PathInfo(pathInfo);
if (mbi != null) {
info.objectName = objectName;
info.mbeanInfo = mbi;
}
return info;
}
}
for (final String root : this.roots) {
if (path.equals(root)) {
return new PathInfo(true);
}
}
return null;
}
Aggregations