Add monitor to NamedThreadFactory

This PR adds a monitor to NamedThreadFactory, and makes sure it is used in as many places as possible, so that we can track thread counts in the various components that creates threads.
I'd prefer to have added the parameter at the end on a new line. I think that makes it easier to resolve the conflicts that sometimes hit parameter lists.