JPS or Ps-ef|grep Java can see which Java processes, this needless to say.
But it is worth mentioning that the JPS command is dependent on some files in/tmp. Some operating systems periodically clean up files in/tmp, resulting in JPS not seeing the actual Java process. But the same is true for Jstat, Jstack and so on, so when the JPS is out of the process, these commands are useless. Not within the scope of our discussion.
Top-p $pid-H plus-H This parameter lists which threads are listed. This allows you to see which thread ID consumes the most system resources.
The thread ID you see is a 10 binary number.
Jstack $pid can print out the stack condition for the Java process.
The thread ID seen by the front top command is converted to a 16 binary display, which can be found in the results of the jstack.
For example, the following:
"Pool-2-thread-1" prio=10 tid=0x000000004c9b2000 nid=0x11f4 waiting on condition [0x0000000042f36000]
Java.lang.Thread.State:WAITING (parking)
At Sun.misc.Unsafe.park (Native Method)
-Parking to wait for <0x0000000580089050> (a java.util.concurrent.locks.abstractqueuedsynchronizer$ Conditionobject)
At Java.util.concurrent.locks.LockSupport.park (locksupport.java:158)
At Java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await (AbstractQueuedSynchronizer.java : 1987)
At Java.util.concurrent.LinkedBlockingQueue.take (linkedblockingqueue.java:399)
At Java.util.concurrent.ThreadPoolExecutor.getTask (threadpoolexecutor.java:947)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:907)
At Java.lang.Thread.run (thread.java:662)
Where the "Nid=0x11f4", 11F4 is the thread ID of the 16 binary representation
JPS See which threads in the Java process are consuming system resources