本文整理匯總了Java中java.lang.management.MonitorInfo.getLockedStackDepth方法的典型用法代碼示例。如果您正苦於以下問題:Java MonitorInfo.getLockedStackDepth方法的具體用法?Java MonitorInfo.getLockedStackDepth怎麽用?Java MonitorInfo.getLockedStackDepth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.management.MonitorInfo
的用法示例。
在下文中一共展示了MonitorInfo.getLockedStackDepth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private static StringBuilder printThreadInfo(ThreadInfo ti, StringBuilder sb) {
// print thread information
printThread(ti, sb);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
sb.append("\t at " + ste.toString()).append("\n");
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
sb.append("\t - locked " + mi).append("\n");
}
}
}
sb.append("\n");
return sb;
}
示例2: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printThreadInfo(ThreadInfo ti, PrintStream out) {
printThread(ti, out);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
out.println(INDENT + "at " + ste.toString()); // NOI18N
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
out.println(INDENT + " - locked " + mi); // NOI18N
}
}
}
out.println();
}
示例3: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
// print thread information
printThread(ti, out);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
out.println(INDENT + "at " + ste.toString());
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
out.println(INDENT + " - locked " + mi);
}
}
}
out.println();
}
示例4: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printThreadInfo(ThreadInfo ti) {
// print thread information
printThread(ti);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
System.out.println(INDENT + "at " + ste.toString());
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
System.out.println(INDENT + " - locked " + mi);
}
}
}
System.out.println();
}
示例5: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printThreadInfo(ThreadInfo ti, StringBuilder dump) {
// print thread information
printThread(ti, dump);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
dump.append(INDENT + "at " + ste.toString());
dump.append("\n");
for (int j = 1; j < monitors.length; j++) {
MonitorInfo mi = monitors[j];
if (mi.getLockedStackDepth() == i) {
dump.append(INDENT + " - locked " + mi);
dump.append("\n");
}
}
}
dump.append("\n");
}
示例6: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printThreadInfo(ThreadInfo threadInfo) {
printThread(threadInfo);
this.sb.append(INDENT).append(threadInfo.toString()).append("\n");
StackTraceElement[] stacktrace = threadInfo.getStackTrace();
MonitorInfo[] monitors = threadInfo.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
this.sb.append(INDENT).append("at ").append(ste.toString()).append("\n");
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
this.sb.append(INDENT).append(" - locked ").append(mi).append("\n");
}
}
}
}
示例7: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private static void printThreadInfo(ThreadInfo ti, StringBuilder sb) {
// print thread information
printThread(ti, sb);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
sb.append(INDENT);
sb.append("at ");
sb.append(ste.toString());
sb.append(System.getProperty("line.separator"));
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
sb.append(INDENT);
sb.append(" - locked ");
sb.append(mi);
sb.append(System.getProperty("line.separator"));
}
}
}
sb.append(System.getProperty("line.separator"));
}
示例8: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printThreadInfo(ThreadInfo ti, StringBuilder dump) {
// print thread information
printThread(ti, dump);
// print stack trace with locks
StackTraceElement[] stacktrace = ti.getStackTrace();
MonitorInfo[] monitors = ti.getLockedMonitors();
for (int i = 0; i < stacktrace.length; i++) {
StackTraceElement ste = stacktrace[i];
dump.append(TAB).append("at ").append(ste.toString()).append('\n');
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == i) {
dump.append(TAB).append(" - locked ").append(mi).append('\n');
}
}
}
dump.append("");
}
示例9: outputMonitors
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
@Override
int outputMonitors(ThreadInfo info, int stack_depth, int monitor_pointer, StringBuffer buffer) {
MonitorInfo[] locked_monitors = info.getLockedMonitors();
boolean check_next_monitor;
do
{
check_next_monitor = false;
if (monitor_pointer < locked_monitors.length)
{
MonitorInfo monitor_info = locked_monitors[monitor_pointer];
if (monitor_info.getLockedStackDepth() == stack_depth)
{
formatLock(monitor_info, "locked", buffer);
buffer.append("\n");
monitor_pointer++;
check_next_monitor = true;
}
}
} while (check_next_monitor);
return monitor_pointer;
}
示例10: printMonitors
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
if (monitors != null) {
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == index) {
sb.append(" - locked "); // NOI18N
printLock(sb, mi);
sb.append("<br>"); // NOI18N
}
}
}
}
示例11: printMonitors
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
if (monitors != null) {
for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == index) {
sb.append("\t- locked "); // NOI18N
printLock(sb,mi);
sb.append("<br>"); // NOI18N
}
}
}
}
示例12: appendStackTrace
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void appendStackTrace(StringBuilder builder, ThreadInfo threadInfo) {
StackTraceElement[] stackTrace = threadInfo.getStackTrace();
int length = stackTrace.length;
for (int i = 0; i < length; i++) {
StackTraceElement stack = stackTrace[i];
builder.append("\tat ").append(stack);
builder.append('\n');
if (i == 0 && threadInfo.getLockInfo() != null) {
Thread.State threadState = threadInfo.getThreadState();
switch (threadState) {
case BLOCKED:
builder.append("\t- blocked on ").append(threadInfo.getLockInfo());
builder.append('\n');
break;
case WAITING:
builder.append("\t- waiting on ").append(threadInfo.getLockInfo());
builder.append('\n');
break;
case TIMED_WAITING:
builder.append("\t- timed-waiting on ").append(threadInfo.getLockInfo());
builder.append('\n');
break;
default:
break;
}
}
for (MonitorInfo monitorInfo : threadInfo.getLockedMonitors()) {
if (monitorInfo.getLockedStackDepth() == i) {
builder.append("\t- locked ").append(monitorInfo);
builder.append('\n');
}
}
}
}
示例13: printMonitors
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
private void printMonitors( List<String> list, MonitorInfo[] monitors, int index )
{
if ( monitors != null )
for ( MonitorInfo mi : monitors )
if ( mi.getLockedStackDepth() == index ) {
StringBuilder sb = new StringBuilder(100);
sb.append("\t- locked ");
printLock(sb, mi);
list.add(sb.toString());
}
}
示例14: VisorThreadMonitorInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
/**
* Create data transfer object for given monitor info.
*
* @param mi Monitoring info.
*/
public VisorThreadMonitorInfo(MonitorInfo mi) {
super(mi);
stackDepth = mi.getLockedStackDepth();
stackFrame = mi.getLockedStackFrame();
}
示例15: printThreadInfo
import java.lang.management.MonitorInfo; //導入方法依賴的package包/類
/**
* Prints single thread info to a buffer.
*
* @param threadInfo Thread info.
* @param sb Buffer.
*/
private static void printThreadInfo(ThreadInfo threadInfo, GridStringBuilder sb, Set<Long> deadlockedIdSet) {
final long id = threadInfo.getThreadId();
if (deadlockedIdSet.contains(id))
sb.a("##### DEADLOCKED ");
sb.a("Thread [name=\"").a(threadInfo.getThreadName())
.a("\", id=").a(threadInfo.getThreadId())
.a(", state=").a(threadInfo.getThreadState())
.a(", blockCnt=").a(threadInfo.getBlockedCount())
.a(", waitCnt=").a(threadInfo.getWaitedCount()).a("]").a(NL);
LockInfo lockInfo = threadInfo.getLockInfo();
if (lockInfo != null) {
sb.a(" Lock [object=").a(lockInfo)
.a(", ownerName=").a(threadInfo.getLockOwnerName())
.a(", ownerId=").a(threadInfo.getLockOwnerId()).a("]").a(NL);
}
MonitorInfo[] monitors = threadInfo.getLockedMonitors();
StackTraceElement[] elements = threadInfo.getStackTrace();
for (int i = 0; i < elements.length; i++) {
StackTraceElement e = elements[i];
sb.a(" at ").a(e.toString());
for (MonitorInfo monitor : monitors) {
if (monitor.getLockedStackDepth() == i)
sb.a(NL).a(" - locked ").a(monitor);
}
sb.a(NL);
}
}