本文整理汇总了Java中java.lang.management.ThreadInfo.getBlockedCount方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadInfo.getBlockedCount方法的具体用法?Java ThreadInfo.getBlockedCount怎么用?Java ThreadInfo.getBlockedCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.management.ThreadInfo
的用法示例。
在下文中一共展示了ThreadInfo.getBlockedCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MyThreadInfo
import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
MyThreadInfo(long cpuTime, ThreadInfo info) {
blockedCount = info.getBlockedCount();
blockedTime = info.getBlockedTime();
waitedCount = info.getWaitedCount();
waitedTime = info.getWaitedTime();
this.cpuTime = cpuTime;
this.info = info;
}
示例2: setDelta
import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
void setDelta(long cpuTime, ThreadInfo info) {
if (deltaDone) throw new IllegalStateException("setDelta already called once");
blockedCount = info.getBlockedCount() - blockedCount;
blockedTime = info.getBlockedTime() - blockedTime;
waitedCount = info.getWaitedCount() - waitedCount;
waitedTime = info.getWaitedTime() - waitedTime;
this.cpuTime = cpuTime - this.cpuTime;
deltaDone = true;
this.info = info;
}
示例3: checkThreadInfo
import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
static void checkThreadInfo(ThreadInfo info) throws Exception {
if (info.getThreadId() != ((Long) values[THREAD_ID]).longValue()) {
throw new RuntimeException("Thread Id = " + info.getThreadId() +
" expected = " + values[THREAD_ID]);
}
if (!info.getThreadName().equals(values[THREAD_NAME])) {
throw new RuntimeException("Thread Name = " +
info.getThreadName() + " expected = " + values[THREAD_NAME]);
}
if (info.getThreadState() != Thread.State.RUNNABLE) {
throw new RuntimeException("Thread Name = " +
info.getThreadName() + " expected = " + Thread.State.RUNNABLE);
}
if (info.getBlockedTime() != ((Long) values[BLOCKED_TIME]).longValue()) {
throw new RuntimeException("blocked time = " +
info.getBlockedTime() +
" expected = " + values[BLOCKED_TIME]);
}
if (info.getBlockedCount() != ((Long) values[BLOCKED_COUNT]).longValue()) {
throw new RuntimeException("blocked count = " +
info.getBlockedCount() +
" expected = " + values[BLOCKED_COUNT]);
}
if (info.getWaitedTime() != ((Long) values[WAITED_TIME]).longValue()) {
throw new RuntimeException("waited time = " +
info.getWaitedTime() +
" expected = " + values[WAITED_TIME]);
}
if (info.getWaitedCount() != ((Long) values[WAITED_COUNT]).longValue()) {
throw new RuntimeException("waited count = " +
info.getWaitedCount() +
" expected = " + values[WAITED_COUNT]);
}
if (!info.getLockName().equals(values[LOCK_NAME])) {
throw new RuntimeException("Lock Name = " +
info.getLockName() + " expected = " + values[LOCK_NAME]);
}
if (info.getLockOwnerId() !=
((Long) values[LOCK_OWNER_ID]).longValue()) {
throw new RuntimeException(
"LockOwner Id = " + info.getLockOwnerId() +
" expected = " + values[LOCK_OWNER_ID]);
}
if (!info.getLockOwnerName().equals(values[LOCK_OWNER_NAME])) {
throw new RuntimeException("LockOwner Name = " +
info.getLockOwnerName() + " expected = " +
values[LOCK_OWNER_NAME]);
}
checkStackTrace(info.getStackTrace());
checkLockInfo(info.getLockInfo());
}
示例4: checkThreadInfo
import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
static void checkThreadInfo(ThreadInfo info) throws Exception {
if (info.getThreadId() != ((Long) values[THREAD_ID]).longValue()) {
throw new RuntimeException("Thread Id = " + info.getThreadId() +
" expected = " + values[THREAD_ID]);
}
if (!info.getThreadName().equals(values[THREAD_NAME])) {
throw new RuntimeException("Thread Name = " +
info.getThreadName() + " expected = " + values[THREAD_NAME]);
}
if (info.getThreadState() != Thread.State.RUNNABLE) {
throw new RuntimeException("Thread Name = " +
info.getThreadName() + " expected = " + Thread.State.RUNNABLE);
}
if (info.getBlockedTime() != ((Long) values[BLOCKED_TIME]).longValue()) {
throw new RuntimeException("blocked time = " +
info.getBlockedTime() +
" expected = " + values[BLOCKED_TIME]);
}
if (info.getBlockedCount() != ((Long) values[BLOCKED_COUNT]).longValue()) {
throw new RuntimeException("blocked count = " +
info.getBlockedCount() +
" expected = " + values[BLOCKED_COUNT]);
}
if (info.getWaitedTime() != ((Long) values[WAITED_TIME]).longValue()) {
throw new RuntimeException("waited time = " +
info.getWaitedTime() +
" expected = " + values[WAITED_TIME]);
}
if (info.getWaitedCount() != ((Long) values[WAITED_COUNT]).longValue()) {
throw new RuntimeException("waited count = " +
info.getWaitedCount() +
" expected = " + values[WAITED_COUNT]);
}
if (!info.getLockName().equals(values[LOCK_NAME])) {
throw new RuntimeException("Lock Name = " +
info.getLockName() + " expected = " + values[LOCK_NAME]);
}
if (info.getLockOwnerId() !=
((Long) values[LOCK_OWNER_ID]).longValue()) {
throw new RuntimeException(
"LockOwner Id = " + info.getLockOwnerId() +
" expected = " + values[LOCK_OWNER_ID]);
}
if (!info.getLockOwnerName().equals(values[LOCK_OWNER_NAME])) {
throw new RuntimeException("LockOwner Name = " +
info.getLockOwnerName() + " expected = " +
values[LOCK_OWNER_NAME]);
}
if (!values[DAEMON].equals(info.isDaemon())) {
throw new RuntimeException("Daemon = " +
info.isDaemon() + " expected = " +
values[DAEMON]);
}
checkStackTrace(info.getStackTrace());
checkLockInfo(info.getLockInfo());
}