开发者

How could I track unknown Thread/Runnable?

I'm developing Java MIDI application.

And I have stuck with debugging of exception, which dispatching at the end of song. As I'm expecting: the application is playing and each time I'm checking the sequence tick position to represent it in application playback line, like as player.

So I want to know how could I get the source or the point where this Thread start running?

Below is an exception output:

Exception in thread "Thread-23" java.lang.IllegalState开发者_JAVA技巧Exception: Sequencer is not open
    at org.tritonus.share.midi.TSequencer.checkOpen(TSequencer.java:296)
    at org.tritonus.share.midi.TSequencer.stop(TSequencer.java:256)
    at org.tritonus.midi.device.java.JavaSequencer.run(JavaSequencer.java:291)
    at java.lang.Thread.run(Unknown Source)


You could install a security manager which allows absolutely everything, but logs out when it's asked for permission to start a thread.

Or, you could provide a replacement Thread implementation and put it ahead of the one in rt.jar by using the bootclasspath options, and have this replacement Thread log its name and stacktrace in its constructor.


org/tritonus/midi/device/java/JavaSequencer.java has the following code:

protected void openImpl()
    {
            ...
            m_thread = new Thread(this);
            ...
            m_thread.start();
    }

So that's one place to look for (but that answers only the specific case, not the general question how to find out where a thread is started in general).

There are also other places in the same class where this.start() is called: in setSequence(..) and setTickPosition(..). There could be calls to start() outside the class however.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜