The TaskRunnerFactory creates a PooledTaskRunner that serializes the background worker threads. This can create a non-optimal runtime where asynchronous tasks become synchronous, and can get stuck behind a long-running task. This is observed when starting an application that makes many different connections to brokers using the failover protocol. The actual connection steps are done in a background thread. One broker takes a long time to initialize the connection, and the others are fast initialization connections. All of the fast initialization connections get stuck behind the slow connection. It would be assumed that these connection initializations should be running simultaneously. If there is a run-time connection interruption, and the failover protocol has to re-connect, the same thing will happen again. This severely degrades the performance of an application.
The solution is to change the TaskRunnerFactory to create a DedicatedTaskRunner. This gives the expected and desired result where the connection initializations execute simultaneously without being queued up.