How to change the thread names of the standard JDK corba ORB threadpool

176 views Asked by At

Is there away to set the standard jdk corba ORB's thread names used in the default thread pool?

By default there are 3 threads per connections. Their name is useless as they always default to: p:default-threadpool; w: Idle. It would be great to change their names mainly for debugging reasons.

Looking at the JDK com.sun.corba.se.impl.orbutil.threadpool.ThreadpoolManagerImpl source I can see that the name cannot be accessed from outside the class. At the moment I use the Thread.currentThread().setName() to set the thread name once I control the thread but it seems a hack. Is there a better way?

1

There are 1 answers

2
assylias On

You could iterate over the threads that are currently running and rename them as required. Something like:

int counter = 1;
for (Thread t : Thread.getAllStackTraces().keySet()) {
  if (t.getName().startsWith("p:default-threadpool")) t.setName("Corba #" + counter++);
}