Created
May 22, 2013 05:08
-
-
Save zhongl/5625366 to your computer and use it in GitHub Desktop.
`StackOverflow` trap in using BTrace.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.Exception; | |
/* | |
TODO: Btrace `jps | grep StackOverflow | grep -oE '[0-9]+'` Script.java | |
import com.sun.btrace.annotations.*; | |
import com.sun.btrace.AnyType; | |
import static com.sun.btrace.BTraceUtils.*; | |
@BTrace | |
public class Script { | |
@OnMethod(clazz = "java.lang.Thread" , method = "getId") | |
public static void trace(@ProbeMethodName String pmn, AnyType[] args) { | |
print(pmn); | |
printArray(args); | |
} | |
} | |
*/ | |
public class StackOverflow { | |
public static void main(String[] args) { | |
while (true){ | |
try { | |
Thread.sleep(2000L); | |
System.out.println("tick thread id: " + Thread.currentThread().getId()); | |
} catch (Exception e) { | |
break; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment