diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
commit | 97b8365cafc3a344a22d3980b8ed885f5c6d8357 (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/java/lang/management/ThreadInfo.java | |
parent | c648dedbde727ca3f883bb5fd773aa4af70d3369 (diff) | |
download | gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.gz |
Merged gcj-eclipse branch to trunk.
From-SVN: r120621
Diffstat (limited to 'libjava/classpath/java/lang/management/ThreadInfo.java')
-rw-r--r-- | libjava/classpath/java/lang/management/ThreadInfo.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libjava/classpath/java/lang/management/ThreadInfo.java b/libjava/classpath/java/lang/management/ThreadInfo.java index 4bf35a4cbeb..428aca3fac8 100644 --- a/libjava/classpath/java/lang/management/ThreadInfo.java +++ b/libjava/classpath/java/lang/management/ThreadInfo.java @@ -102,7 +102,7 @@ public class ThreadInfo /** * The state of the thread which this instance concerns. */ - private String threadState; + private Thread.State threadState; /** * The number of times the thread has been blocked. @@ -200,10 +200,12 @@ public class ThreadInfo long waitedTime, boolean isInNative, boolean isSuspended, StackTraceElement[] trace) { - this(thread.getId(), thread.getName(), thread.getState(), blockedCount, - blockedTime, lock.getClass().getName() + "@" + - Integer.toHexString(System.identityHashCode(lock)), lockOwner.getId(), - lockOwner.getName(), waitedCount, waitedTime, isInNative, isSuspended, + this(thread.getId(), thread.getName(), thread.getState(), blockedCount, blockedTime, + lock == null ? null : lock.getClass().getName() + "@" + + Integer.toHexString(System.identityHashCode(lock)), + lockOwner == null ? -1 : lockOwner.getId(), + lockOwner == null ? null : lockOwner.getName(), + waitedCount, waitedTime, isInNative, isSuspended, trace); } @@ -240,7 +242,7 @@ public class ThreadInfo * @param trace the stack trace of the thread to a pre-determined * depth (see VMThreadMXBeanImpl) */ - private ThreadInfo(long threadId, String threadName, String threadState, + private ThreadInfo(long threadId, String threadName, Thread.State threadState, long blockedCount, long blockedTime, String lockName, long lockOwnerId, String lockOwnerName, long waitedCount, long waitedTime, boolean isInNative, boolean isSuspended, @@ -387,7 +389,7 @@ public class ThreadInfo dTraces[a].get("lineNumber")).intValue()); return new ThreadInfo(((Long) data.get("threadId")).longValue(), (String) data.get("threadName"), - (String) data.get("threadState"), + Thread.State.valueOf((String) data.get("threadState")), ((Long) data.get("blockedCount")).longValue(), ((Long) data.get("blockedTime")).longValue(), (String) data.get("lockName"), @@ -484,7 +486,7 @@ public class ThreadInfo */ public String getLockName() { - if (threadState.equals("BLOCKED")) + if (threadState != Thread.State.BLOCKED) return null; return lockName; } @@ -502,7 +504,7 @@ public class ThreadInfo */ public long getLockOwnerId() { - if (threadState.equals("BLOCKED")) + if (threadState != Thread.State.BLOCKED) return -1; return lockOwnerId; } @@ -520,7 +522,7 @@ public class ThreadInfo */ public String getLockOwnerName() { - if (threadState.equals("BLOCKED")) + if (threadState != Thread.State.BLOCKED) return null; return lockOwnerName; } @@ -577,7 +579,7 @@ public class ThreadInfo * * @return the thread's state. */ - public String getThreadState() + public Thread.State getThreadState() { return threadState; } @@ -695,7 +697,7 @@ public class ThreadInfo ", waitedCount=" + waitedCount + ", isInNative=" + isInNative + ", isSuspended=" + isSuspended + - (threadState.equals("BLOCKED") ? + (threadState == Thread.State.BLOCKED ? ", lockOwnerId=" + lockOwnerId + ", lockOwnerName=" + lockOwnerName : "") + "]"; |