Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread having its own ExecutorService

 
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.
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!