use of com.sun.management.HotSpotDiagnosticMXBean in project jdk8u_jdk by JetBrains.
the class GetVMOption method main.
public static void main(String[] args) throws Exception {
List<HotSpotDiagnosticMXBean> list = ManagementFactory.getPlatformMXBeans(HotSpotDiagnosticMXBean.class);
HotSpotDiagnosticMXBean mbean = list.get(0);
checkVMOption(mbean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbean = ManagementFactory.newPlatformMXBeanProxy(mbs, HOTSPOT_DIAGNOSTIC_MXBEAN_NAME, HotSpotDiagnosticMXBean.class);
checkVMOption(mbean);
}
use of com.sun.management.HotSpotDiagnosticMXBean in project jdk8u_jdk by JetBrains.
the class SetAllVMOptions method main.
public static void main(String[] args) throws Exception {
List<HotSpotDiagnosticMXBean> list = ManagementFactory.getPlatformMXBeans(HotSpotDiagnosticMXBean.class);
HotSpotDiagnosticMXBean mbean = list.get(0);
setAllVMOptions(mbean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbean = ManagementFactory.newPlatformMXBeanProxy(mbs, HOTSPOT_DIAGNOSTIC_MXBEAN_NAME, HotSpotDiagnosticMXBean.class);
setAllVMOptions(mbean);
}
use of com.sun.management.HotSpotDiagnosticMXBean in project jgnash by ccavanaugh.
the class ConsoleDialog method dumpHeap.
private static void dumpHeap() {
final String base = FileSystemView.getFileSystemView().getDefaultDirectory().getAbsolutePath();
for (int i = 1; i < MAX_DUMP_FILES; i++) {
// no more than 1000 dumps
final File dumpFile = new File(base + FileUtils.separator + "jGnashHeapDump" + i + ".bin");
if (!dumpFile.exists()) {
final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
try {
final HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy(server, "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
bean.dumpHeap(dumpFile.getAbsolutePath(), true);
} catch (IOException e) {
Logger.getLogger(ConsoleDialog.class.getCanonicalName()).log(Level.SEVERE, null, e);
}
break;
}
}
}
use of com.sun.management.HotSpotDiagnosticMXBean in project jdk8u_jdk by JetBrains.
the class GetDiagnosticOptions method main.
public static void main(String[] args) throws Exception {
List<HotSpotDiagnosticMXBean> list = ManagementFactory.getPlatformMXBeans(HotSpotDiagnosticMXBean.class);
HotSpotDiagnosticMXBean mbean = list.get(0);
checkDiagnosticOptions(mbean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbean = ManagementFactory.newPlatformMXBeanProxy(mbs, HOTSPOT_DIAGNOSTIC_MXBEAN_NAME, HotSpotDiagnosticMXBean.class);
checkDiagnosticOptions(mbean);
}
use of com.sun.management.HotSpotDiagnosticMXBean in project Lucee by lucee.
the class HeapDumper method dumpTo.
/**
* Dumps the heap to the outputFile file in the same format as the hprof heap dump.
* If this method is called remotely from another process, the heap dump output is written to a file named outputFile on the machine where the target VM is running. If outputFile is a relative path, it is relative to the working directory where the target VM was started.
* @param res Resource to write the .hprof file.
* @param live if true dump only live objects i.e. objects that are reachable from others
* @throws IOException
*/
public static void dumpTo(Resource res, boolean live) throws IOException {
MBeanServer mbserver = ManagementFactory.getPlatformMBeanServer();
HotSpotDiagnosticMXBean mxbean = ManagementFactory.newPlatformMXBeanProxy(mbserver, "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
String path;
Resource tmp = null;
if (res instanceof FileResource)
path = res.getAbsolutePath();
else {
tmp = SystemUtil.getTempFile("hprof", false);
path = tmp.getAbsolutePath();
}
try {
// it only
mxbean.dumpHeap(path, live);
} finally {
if (tmp != null && tmp.exists()) {
tmp.moveTo(res);
}
}
}
Aggregations