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 223307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:12:32+00:00 2026-05-11T19:12:32+00:00

newCachedThreadPool() versus newFixedThreadPool() When should I use one or the other? Which strategy is

  • 0

newCachedThreadPool() versus newFixedThreadPool()

When should I use one or the other? Which strategy is better in terms of resource utilization?

  • 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-05-11T19:12:32+00:00Added an answer on May 11, 2026 at 7:12 pm

    I think the docs explain the difference and usage of these two functions pretty well:

    newFixedThreadPool

    Creates a thread pool that reuses a
    fixed number of threads operating off
    a shared unbounded queue. At any
    point, at most nThreads threads will
    be active processing tasks. If
    additional tasks are submitted when
    all threads are active, they will wait
    in the queue until a thread is
    available. If any thread terminates
    due to a failure during execution
    prior to shutdown, a new one will take
    its place if needed to execute
    subsequent tasks. The threads in the
    pool will exist until it is explicitly
    shutdown.

    newCachedThreadPool

    Creates a thread pool that creates new
    threads as needed, but will reuse
    previously constructed threads when
    they are available. These pools will
    typically improve the performance of
    programs that execute many short-lived
    asynchronous tasks. Calls to execute
    will reuse previously constructed
    threads if available. If no existing
    thread is available, a new thread will
    be created and added to the pool.
    Threads that have not been used for
    sixty seconds are terminated and
    removed from the cache. Thus, a pool
    that remains idle for long enough will
    not consume any resources. Note that
    pools with similar properties but
    different details (for example,
    timeout parameters) may be created
    using ThreadPoolExecutor constructors.

    In terms of resources, the newFixedThreadPool will keep all the threads running until they are explicitly terminated. In the newCachedThreadPool Threads that have not been used for sixty seconds are terminated and removed from the cache.

    Given this, the resource consumption will depend very much in the situation. For instance, If you have a huge number of long running tasks I would suggest the FixedThreadPool. As for the CachedThreadPool, the docs say that “These pools will typically improve the performance of programs that execute many short-lived asynchronous tasks”.

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

Sidebar

Ask A Question

Stats

  • Questions 168k
  • Answers 168k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm going to guess that what you're asking is 'Can… May 12, 2026 at 1:38 pm
  • Editorial Team
    Editorial Team added an answer Far as I can see, there are a lot of… May 12, 2026 at 1:38 pm
  • Editorial Team
    Editorial Team added an answer You may try adding the "cache: false" option. May 12, 2026 at 1:38 pm

Related Questions

I've got a collection of records to process, and the processing can be parallelized,
I am fairly naive when it comes to the world of Java Threading and
In the code below, I'm catching a TimeoutException after 100 seconds as intended. At
I have some problem with CompletionService. My task: to parse parallely for about 300

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.