Change threading behaviour so only a maxThreads number of writing thread...

...s will be spawned.

Fix bugs :
1. Don't thread bomb the system with checker threads.
2. When writing above threshold events per flush, don't spawn multiple threads to handle the same data, which possibly results in duplicate data. Instead if maxThreads are running temporarily increase threshold by an order of magnitude and back off.

Potential issues.

It may be better to break large writes into several smaller writes to the API. Especially when the system is under load. But in my testing this seems ok.