Is there any way in Java to log *every* Thread interrupt?

前端 未结 5 884
清酒与你
清酒与你 2021-02-06 12:11

I would like to somehow log every time Thread.interrupt() is called, logging which Thread issued the call (and its current stack) as well as identifying information

5条回答
  •  甜味超标
    2021-02-06 12:46

    Before trying anything too wild, have you considered using the Java debugging API? I'd think that capturing MethodEntryEvents on Thread.interrupt() would do it.

    Eeek, that's the old interface, you should also check oout the new JVM Tool Interface.

提交回复
热议问题