Replies: 1 comment
-
|
교착 상태란 획득한 리소스의 락을 걸고 다른 프로세스/스레드의 리소스를 무한히 기다리면서 아무것도 진행 못하는 상황입니다. 교착 상태의 발생 조건은 상호 배제(Mutual Exclusion), 점유 대기(Hold and Wait), 비선점(No preemption), 순환 대기(Circular wait)입니다.
ThreadMXBean bean = ManagementFactory.getThreadMXBean();
long[] threadIds = bean.findDeadlockedThreads(); // 교착 상태 스레드 확인
if (threadIds != null) {
ThreadInfo[] infos = bean.getThreadInfo(threadIds);
for (ThreadInfo info : infos) {
System.out.println("Deadlock detected involving thread: " + info.getThreadName());
}
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
.
Beta Was this translation helpful? Give feedback.
All reactions