Relates :
|
|
Relates :
|
|
Relates :
|
There is sometimes teh case when ThreadID gottten by TheadMXBean.getAllThreadIds() becomes zero. The attached program works to pass the threadID gotten by getAllThreadIds() to getThreadInfo(). The passed threadID is zero, IllegalArgumentException arises. REPRODUCE: 1) Compile the sttached test program: ThreadInfoGetter.java 2) Launch "java ThreadInfoGetter" K:\shares2\threadid-becomes-zero>java ThreadInfoGetter java.lang.IllegalArgumentException: Invalid thread ID entry at sun.management.ThreadImpl.getThreadInfo0(Native Method) at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:147) at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:128) at ThreadInfoGetter.run(ThreadInfoGetter.java:33) --- Invalid thread ID entries = [0, 8, 5, 4, 3, 2] Loop count = 19800 K:\shares2\threadid-becomes-zero>java -version java version "1.6.0-beta2" Java(TM) SE Runtime Environment (build 1.6.0-beta2-b76) Java HotSpot(TM) Client VM (build 1.6.0-beta2-b76, mixed mode) FREQUENCY: 2 times of 10 trials with test program INVESTIGATION: When AttachCurrentThread() is called , there seems short period which threadID is zero. (threadID is not assined) During such short period, if unassigned threadID is referred, IllegalArgumentException occurs.
|