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

  • SEARCH
  • Home
  • 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 7914237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:02:55+00:00 2026-06-03T14:02:55+00:00

The ThreadPoolExecutor class in the Java SE 6 docs has the following method :

  • 0

The ThreadPoolExecutor class in the Java SE 6 docs has the following method:

public int getActiveCount()

Returns the approximate number of threads
that are actively executing tasks.

What is the meaning of approximate and actively executing here?

Is there any guarantee that, if before, during and after the call to getActiveCount()

  1. N threads have been allotted from the pool for task execution, and
  2. None of these N threads are available for further task assignment,

the integer returned by getActiveCount() will be exactly N?

If getActiveCount() does not provide this guarantee, is there any other way to obtain this information in a more precise manner?

Prior SO Questions:

I have looked at Thread Pool Executor Monitoring Requirement and How to tell if there is an available thread in a thread pool in java, but they do not answer my queries.

  • 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-03T14:02:59+00:00Added an answer on June 3, 2026 at 2:02 pm

    The reason that it is approximate is because the number could change during the calculation; you’re multi-threading. Before the calculation completes a different number of threads could now be active (A thread that was inactive when checked is now active).

    When you say “particular time instance” … that doesn’t really mean anything. The calculation isn’t instantaneous. The number you get back is the best possible answer given the fluid/dynamic nature of the pool.

    If by chance the calculation starts and completes while none of the threads in the pool change state, then yes that number is “exact” but only until a thread in the pool changes state, which means it might only be “exact” for 1ms (or less).

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

Sidebar

Related Questions

I'm using the secret hidden ShellFolder class in Java. It has a nice method
I'm trying to use Java's ThreadPoolExecutor class to run a large number of heavy
The ThreadPoolExecutor class allows to give a custom ThreadFactory to create new threads. However,
I'm looking for a java thread-pool, that won't run more threads simultaneously than there
I noticed that my java application (runs on tomcat6) spawns a lot of threads
I'm using a ThreadPoolExecutor in Java to manage a lot of running threads. I've
How would you name a class with the following public interface: /// <summary> ///
Look ath this method of ThreadPoolExcecutor: public void execute(Runnable command) { ... if (runState
I am using the ThreadPoolExecutor to implement threading in my Java Application. I have
I am getting this exception on my tomcat server (+liferay) java.util.concurrent.RejectedExecutionException my class 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.