use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.
the class InfoLockCommand method showSystemLocks.
private void showSystemLocks() {
Vector vMonitorsWithLockedObjects = new Vector();
JavaRuntime jRuntime = ctx.getRuntime();
Iterator monitors = jRuntime.getMonitors();
out.println("\nSystem locks...");
while (monitors.hasNext()) {
JavaMonitor jMonitor = (JavaMonitor) monitors.next();
JavaObject jObject = jMonitor.getObject();
try {
String monitorName = jMonitor.getName().trim();
if (monitorName.equalsIgnoreCase("")) {
monitorName = "<un-named monitor>";
}
out.println("id: 0x" + jMonitor.getID() + " name: " + jMonitor.getName());
JavaThread owner = jMonitor.getOwner();
if (null != owner) {
try {
out.println("\towner thread id: " + owner.getImageThread().getID() + " name: " + owner.getName());
} catch (DataUnavailable e) {
out.println("\towner thread id: " + Exceptions.getDataUnavailableString());
logger.log(Level.FINE, Exceptions.getDataUnavailableString(), e);
}
}
showWaiters(jMonitor);
} catch (CorruptDataException cde) {
out.println("\nwarning, corrupt data encountered during scan for system locks...");
}
if (null != jObject) {
// Remember object monitors (flat or inflated) for later
vMonitorsWithLockedObjects.add(jMonitor);
}
}
showLockedObjects(vMonitorsWithLockedObjects);
}
use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.
the class InfoLockCommand method showLockedObjects.
private void showLockedObjects(Vector vMonitorsWithLockedObjects) {
out.println("\nObject Locks in use...");
if (0 == vMonitorsWithLockedObjects.size()) {
out.println("\t...None.");
return;
}
Iterator lockedObjects = vMonitorsWithLockedObjects.iterator();
while (lockedObjects.hasNext()) {
JavaMonitor jMonitor = (JavaMonitor) lockedObjects.next();
JavaObject jObject = jMonitor.getObject();
try {
JavaThread owner = jMonitor.getOwner();
String className = "<unknown class>";
JavaClass jClass = jObject.getJavaClass();
if (null != jClass) {
className = jClass.getName();
}
String jObjectID = Long.toHexString(jObject.getID().getAddress());
if (null == owner) {
out.println(className + "@0x" + jObjectID);
} else {
String owningThreadID = null;
try {
owningThreadID = owner.getImageThread().getID();
} catch (DataUnavailable e) {
owningThreadID = Exceptions.getDataUnavailableString();
}
out.println(className + "@0x" + jObjectID);
out.println("\towner thread id: " + owningThreadID + " name: " + owner.getName());
}
showWaiters(jMonitor);
} catch (CorruptDataException cde) {
logger.log(Level.FINE, Exceptions.getCorruptDataExceptionString(), cde);
}
}
}
use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.
the class InfoMemoryCommand method printDbgmallocWarning.
private void printDbgmallocWarning(PrintStream out, JavaRuntime runtime) {
try {
boolean dbgmalloc = false;
JavaVMInitArgs args = runtime.getJavaVMInitArgs();
if (args != null) {
Iterator<?> opts = args.getOptions();
while (opts.hasNext()) {
Object obj = opts.next();
if (obj instanceof JavaVMOption) {
JavaVMOption opt = (JavaVMOption) obj;
if (COM_IBM_DBGMALLOC_PROPERTY.equals(opt.getOptionString())) {
dbgmalloc = true;
}
}
}
}
if (!dbgmalloc) {
out.println();
out.printf("Note: %s was not found in the Java VM init options.\nMemory allocated by some class library components will not have been recorded.\n", COM_IBM_DBGMALLOC_PROPERTY);
}
} catch (DataUnavailable du) {
out.println("Java VM init options information unavailable.");
logger.log(Level.FINE, Exceptions.getDataUnavailableString(), du);
} catch (CorruptDataException cde) {
out.println("Corrupt Data encountered walking Java VM init options");
logger.log(Level.FINE, Exceptions.getCorruptDataExceptionString(), cde);
}
}
use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.
the class InfoMemoryCommand method run.
public void run(String command, String[] args, IContext context, PrintStream out) throws CommandException {
if (initCommand(command, args, context, out)) {
// processing already handled by super class
return;
}
JavaRuntime runtime = ctx.getRuntime();
try {
Iterator memoryCategories = runtime.getMemoryCategories();
printAllMemoryCategories(out, memoryCategories);
printDbgmallocWarning(out, runtime);
} catch (DataUnavailable du) {
out.println("Memory categories information unavailable.");
logger.log(Level.FINE, Exceptions.getDataUnavailableString(), du);
}
}
use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.
the class InfoThreadCommand method printStackFrameInfo.
private void printStackFrameInfo(ImageThread it) {
Iterator itStackFrame;
ImageStackFrame isf;
try {
itStackFrame = it.getStackFrames();
} catch (DataUnavailable d) {
out.print(" native stack frames: " + Exceptions.getDataUnavailableString() + "\n");
return;
}
out.print(" native stack frames:");
out.print("\n");
while (itStackFrame.hasNext()) {
Object o = itStackFrame.next();
if (o instanceof CorruptData) {
out.print(" <corrupt stack frame: " + ((CorruptData) o).toString() + ">\n");
continue;
}
isf = (ImageStackFrame) o;
out.print(" bp: ");
try {
out.print(toAdjustedHex(isf.getBasePointer().getAddress()));
} catch (CorruptDataException e) {
if (getArtifactType() == ArtifactType.javacore) {
// javacore does not provide native stack base pointers, show as unavailable, not corrupt
out.print(Exceptions.getDataUnavailableString());
} else {
out.print(Exceptions.getCorruptDataExceptionString());
}
}
out.print(" pc: ");
try {
out.print(toAdjustedHex(isf.getProcedureAddress().getAddress()));
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
}
out.print(" ");
try {
out.print(isf.getProcedureName());
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
}
out.print("\n");
}
}
Aggregations