java.lang.Thread has a setName()
method. If the thread you want to name extends Thread, you can call setName("myThread")
on it.
EDIT: Based on this suggestion, Alper Akture was able to figure out an actual solution.
ExecutorService
has a constructor that accepts a ThreadFactory
, and the ThreadFactory
can be told to create named threads.