SI-7399 : Take scala.concurrent.context.maxThreads into account

This change fixes the bug whereby specifiying maxThread as a property
has no effect. A small refactoring is applied in the process.
Merge pull request #2424 from rjolly/si-7399

SI-7399 : Take scala.concurrent.context.maxThreads into account