jboss-msc/jboss-msc — pull request #34 by donovanmuller (2014-11-14 09:10:45+00:00)
Title: Make the use of 'jboss.msc.max.container.threads' consistent.

This PR is related to [MSC-144](https://issues.jboss.org/browse/MSC-144).

Wildfly 8.1.0.Final running on Solaris with many cores, caused a large amount of MSC threads to be started (> 32) Investigation led to the use of `jboss.msc.max.container.threads` which at first glance, sounds like the solution. However, setting this property had no effect.

The reason being that Wildfly does not invoke the factory methods with the fix (https://github.com/jboss-msc/jboss-msc/commit/b071e3ccce42784bece4fe27db1da163524d4916). In the absence of the `org.jboss.server.bootstrap.maxThreads` property, it too does a `cores * 2` calculation ([here](https://github.com/wildfly/wildfly/blob/8.1.0.Final/server/src/main/java/org/jboss/as/server/ServerEnvironment.java#L932) used [here](https://github.com/wildfly/wildfly/blob/8.1.0.Final/server/src/main/java/org/jboss/as/server/BootstrapImpl.java#L55)) and invokes [this](https://github.com/wildfly/wildfly/blob/8.1.0.Final/server/src/main/java/org/jboss/as/server/BootstrapImpl.java#L197) factory method, which does not apply the `jboss.msc.max.container.threads` property. The result being that the `jboss.msc.max.container.threads` property has no affect, or at least is not what you would expect.

[This forum thread](https://developer.jboss.org/thread/243505) highlights the confusion caused by the current implementation.

This PR attempts to make the usage of `jboss.msc.max.container.threads` consistent, as it enforces that `MAX_THREADS_COUNT` is always considered and enforced by all factory methods. Regardless of where the core calculation comes from.

References:
* https://issues.jboss.org/browse/MSC-144
* https://twitter.com/aminize/status/446211421538222081
* https://developer.jboss.org/thread/243505