Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8518977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:07:26+00:00 2026-06-11T06:07:26+00:00

Java – webapp what is the advantage of executing thread via Executors class as

  • 0

Java – webapp what is the advantage of executing thread via Executors class as following code other then running with fixed pool size.

private ExecutorService threadRunner;
threadRunner = Executors.newFixedThreadPool(2);

threadRunner.submit(activeQueueRunner);
threadRunner.submit(standbyQueueRunner);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:07:27+00:00Added an answer on June 11, 2026 at 6:07 am

    Threads contain a lot of supporting structures which are expensive to create. Executors are pools of threads that get created once, but are wrapped with the required supporting code to be reused amongst multiple tasks.

    In other words, if you are submitting only two items to a new fixed thread pool of size two, you have no advantage. The advantage comes when you submit your third item to the threadRunner pool, as it will bind to one of the completed task’s former threads(activeQueueRunner or standbyQueueRunner), and use that thread to exercise its run(...) block.

    If you write your submitted tasks to never complete, then they will basically never release the thread back to the pool. So when using an Executor type pool, it is a good idea to make lots of quick lightweight tasks and let the pool amortize the expensive cost of creating / destroying Threads over the entire run of the program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Java noob question: Consider the following C array and initializer code: struct { int
Java Code : DOMConfigurator.configureAndWatch(log4jConfigFile.getAbsolutePath(),100000L); I need to add some appenders programmaticaly whenever Thread created
Java Concurrency in Practice gives the following example of an unsafe class which due
Java Code: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegExpTest { public static void main(String[]
Java Code : package Package; public class IntArray { private native int sumArray(int[] arr);
Java Code: public class Car { //variables int myStartMiles; int myEndMiles; double myGallonsUsed; int
Java newbie here, I am trying to find the output of the following chunk
Java Code need to write an equivalent in objectiveC. CAn you please help me
Java Code: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( http://localhost/SC/upload.php); FileBody
Java fb API I am creating facebook web application, to create even following is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.