[concurrency-interest] Class striped/ordered Thread Pool

Glenn McGregor glenn at 8950aaa.com
Fri May 11 01:14:18 EDT 2012

On 5/10/2012 10:07 PM, David Holmes wrote:
> Not sure if this makes sense unless you use a SingleThreadExecutor per 
> stripeClass. Otherwise you have races in the submission of 
> StripedRunners of the same stripeClass, and even if you order the 
> queue so that they start execution in the right order, you can't 
> guarantee what order they will complete in. Unless it is all done by a 
> single thread.
> David Holmes

I can guarantee that items of the same class are generated by one thread.

To expand on my particular use case...

I have a small number of threads using NIO to read multiple TCP or SCTP 
data streams.
I need to process TLS in order for a given socket.
But a given TLS stream is only read by one thread.

So what I want to hand off my TLS work to a thread pool, but need to 
keep particular streams in sequence.


Glenn McGregor

>     -----Original Message-----
>     *From:* concurrency-interest-bounces at cs.oswego.edu
>     [mailto:concurrency-interest-bounces at cs.oswego.edu]*On Behalf Of
>     *Glenn McGregor
>     *Sent:* Friday, 11 May 2012 2:54 PM
>     *To:* concurrency-interest at cs.oswego.edu
>     *Subject:* [concurrency-interest] Class striped/ordered Thread Pool
>     Hello all,
>     I'm looking for a thread pool with the following
>     characteristics... (in pseudo-code)
>     interface StripedRunner {
>         Object getStripeClass();
>         void run();
>     }
>     magicPool.execute( stripedRunner );
>     The idea being that any StripedRunners with the same stripeClass
>     would get executed in the order they were queued,
>     but StripedRunners with different stripedClasses could execute
>     independently.
>     Is there a way to configure the standard concurrent pools to work
>     this way (doesn't seem to be), or a way to extends
>     the current code?
>     Or perhaps some third party library implementation?
>     Thanks!
>     Glenn McGregor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120510/fee266f1/attachment.html>

More information about the Concurrency-interest mailing list