use of org.neo4j.kernel.diagnostics.DiagnosticsReportSource in project neo4j by neo4j.
the class JmxDump method systemProperties.
public DiagnosticsReportSource systemProperties() {
return new DiagnosticsReportSource() {
@Override
public String destinationPath() {
return "vm.prop";
}
@Override
public InputStream newInputStream() {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
systemProperties.list(new PrintStream(out, true));
return new ByteArrayInputStream(out.toByteArray());
}
@Override
public long estimatedSize() {
return 0;
}
};
}
use of org.neo4j.kernel.diagnostics.DiagnosticsReportSource in project neo4j by neo4j.
the class JmxDump method heapDump.
public DiagnosticsReportSource heapDump() {
return new DiagnosticsReportSource() {
@Override
public String destinationPath() {
return "heapdump.hprof";
}
@Override
public InputStream newInputStream() throws IOException {
final Path heapdumpFile = createTempFile("neo4j-heapdump", ".hprof").toAbsolutePath();
heapDump(heapdumpFile.toString());
return new FileInputStream(heapdumpFile.toFile()) {
@Override
public void close() throws IOException {
super.close();
deleteIfExists(heapdumpFile);
}
};
}
@Override
public long estimatedSize() {
try {
final MemoryMXBean bean = ManagementFactory.getPlatformMXBean(mBeanServer, MemoryMXBean.class);
final long totalMemory = bean.getHeapMemoryUsage().getCommitted() + bean.getNonHeapMemoryUsage().getCommitted();
// We first write raw to disk then write to archive, 5x compression is a reasonable worst case estimation
return (long) (totalMemory * 1.2);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
};
}
Aggregations