Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Pooling  RSS feed

 
James Shailes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to set up thread pooling so that I can have many threads consuming and processing messages from a JMS queue. I thought I had found the solution upon reading about ThreadPoolTaskExecutor however I can't seem to find a way of prioritising thread execution. If I can briefly explain an abstraction of what I'm trying to do:

1. The jms queue is being populated from an external source with messages of the format {customerId, foodId}, for example customer 1 has bought an apple. Customer 1 may also have bought a pear but this would be a separate message.

2. Only one thread in the pool can be processing the same customerId at any one time.

It is step 2 that I'm really struggling with as I can't see a way for a ThreadPoolTaskExecutor to prevent execution of a message {customer1, pear} until {customer1, apple} has finished executing.

Can anyone point me in the right direction?

Cheers,

James
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's wrong with the answers you got on the Sun Concurrency Forum?
http://forums.sun.com/thread.jspa?threadID=5414946&tstart=0

Others here may not know about the other answers and waste their time. This is the reason for not posting the same question to multiple Forums.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!