[concurrency-interest] Class striped/ordered Thread Pool

Gregg Wonderly gregg at cytetech.com
Wed May 16 08:10:04 EDT 2012

On 5/16/2012 3:16 AM, Dr Heinz M. Kabutz wrote:
> I've spent yesterday and part of today looking at various approaches to solve
> this problem.
> 1. My idea of a striped queue would not work, because tasks are not always
> enqueued before they are handed off to workers.
> 2. I've got a nice solution utilizing the SerialExecutor approach, however, as
> Joe mentioned, shutdown is particularly challenging. I'm still trying to solve
> that, but it is not easy.
> 3. Another challenge, also mentioned already in this thread, is that we need to
> carefully manage the map so that we do not get a memory leak. The solution I'm
> trying now is to delete the SerialExecutor from the map whenever it is empty.
> This might create a lot of objects, but at least we don't have to worry about a
> memory leak.

This is precisely the type of place where I use a counter to manage lifecycle 
beginning and end.  Code needs to be completely correct, before it is 
"completely efficient".  I've rarely ever had to decide to start optimizing 
these kinds of places once I have things up and running and do some 
instrumentation.  Rarely, are these the hot spots for latency injection.


More information about the Concurrency-interest mailing list