• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread vs Executor

 
rakesh sugirtharaj
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the advantage of using Executors over conventional threading? Can anyone explain with a simple example?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Find a copy of Java Concurrency in Practice by Brian Goetz, Tim Peierls, Joseph Bowbeer, David Holmes, Joshua Bloch, Doug Lea.

I think this thread would sit better in the threads forum, so I shall move it.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Executors is a threadpool.
Its costly to create a new thread everytime to process a task.
Its effective and recommended to reuse threads if possible.
Executors do just that for you.

This is the basic benefit of using Executors over thread creation per task.

For detailed discussions do read the book that Campbell has pointed out!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic