• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread having its own ExecutorService  RSS feed

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My thread reads from a queue and wants to process each dequeue item in a separate thread. I want to ask the collective wisdom in javaranch if this
seems weird/wrong. The reason I want to do this is because the fork threads
will send the dequeued object via socket connections to a remote server.
Let me know your thoughts. Thanks.

e.g. pseudocode
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Executors in Java 5 will do this all for you.

See the docs on Executors and Sun tutorials on Concurrency.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!