0

I have an application with a lot of threads. I'm trying to analyze a specific thread's call stack in VisualVM.

I'm logging the thread name in my application like so:

log.warn("Placard thread: [" + Thread.currentThread().getName() + "]");

But the threads in VisualVM are all named like Thread-47, Thread-48, Timer-2, and so on. Where are the thread names in VisualVM coming from? How can I connect them with some value that I can use programmatically?

Thanks!

Kramer
  • 927
  • 2
  • 13
  • 30
  • I believe threads have both a name and id, so it could be `thread.getName() + '-' + thread.getId()`. – Locke May 30 '19 at 16:55
  • You can name your threads, it makes it easier to know what's going on. Thread.currentThread().setName("My Thread that does interesting things") – David Zimmerman May 30 '19 at 18:49

0 Answers0