Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding JVM's "Attach Listener" thread

When I use

jstack -l pid

to see the thread's dump info, I get result as follow:

"Attach Listener" daemon prio=10 tid=0x01e4a800 nid=0x109c waiting on condition
[0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

My questions are as follow:

  1. What's the function of "Attach Listener" thread?
  2. When does this thread be created? Where? I can't find it.

Thank you very much.

like image 552
diecui1202 Avatar asked Nov 22 '11 09:11

diecui1202


People also ask

What is attach listener in Java?

Dynamic attach has an attach listener thread in the target JVM. This is a thread that is started when the first attach request occurs. Follow this answer to receive notifications.

When should I take thread dump?

You can do thread dumps whenever you see fit to analyse anything to do with thread lock contention, deadlock detection, system resource contention, ... This is why there are tools to facilitate thread dump whenever we see fit, not only after a JVM crash.

How many threads are currently running in the JVM?

Each JVM server can have a maximum of 256 threads to run Java applications.


1 Answers

See here http://openjdk.java.net/groups/hotspot/docs/Serviceability.html

Find "Dynamic Attach”

Dynamic attach has an attach listener thread in the target JVM. This is a thread that is started when the first attach request occurs.

like image 168
diecui1202 Avatar answered Oct 20 '22 11:10

diecui1202