Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find source of Timer thread?

I have a big project that also use many libraries. With jstack I found that there are threads like:

Timer-2, Timer-3, Timer-4....

and all that jstack can me display is:

java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.util.TimerThread.mainLoop(Unknown Source)
    - locked <0x1a013c24> (a java.util.TaskQueue)
    at java.util.TimerThread.run(Unknown Source)

Is it possible to find a class where these threads where created?

like image 838
user710818 Avatar asked Jan 16 '12 11:01

user710818


People also ask

Does threading timer create a new thread?

Yes, it will create new threads.

Is timer a thread?

The timer isn't a thread BUT having a timer fire events asynchronously can be regarded as a form of multi-threading - along with all the traditional multi-threading issues!


1 Answers

The Timer threads are created by the java.util.Timer.

If you are able to use the debugger you should be able to set a breakpoint in the Timer constructors and find out the source.

like image 130
ante Avatar answered Sep 28 '22 06:09

ante