Maybe I'm looking at the wrong places but I don't see any
usages of
ThreadGroup#setMaxPriority() in either Wildfly or in Wildfly Core. Is
anybody aware of them being used anywhere?
I don't see any. I think in the end we are all inheriting from the VM 'main'
thread group and its Thread.MAX_PRIORITY setting. Which I think is fine (see my other post
just now).
The other thing a ThreadGroup has is a name. But I'm not seeing much use of
ThreadGroup.getName() either, in our code or in the VM. The most significant use I see is
if you include '%p' or '%G' in the 'namePattern' param, then the
TG name becomes part of the name of the Threads the factory creates. And then that of
course is widely visible, e.g. in stack traces or log statements via handlers that include
the thread name in their formatter, as our OOTB handlers do.
I've kind of convinced myself that if we're not setting the maxPriority and
we're not using the group name in the Thread name pattern we should probably get rid
of the ThreadGroup altogether.
Having good thread names is important, so we don't want to make then worse by removing
the TG name if it's being used and is meaningful. But it's certainly possible to
provide a good thread name without relying on the TG name; most of our thread factories
don't.