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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:18:33+00:00 2026-06-11T07:18:33+00:00

i have java process that sends emails for different email address and i am

  • 0

i have java process that sends emails for different email address and i am using java thread pool executor, each thread try to send e-mail and then exits

the problem is all the threads are going to wait state and can never come back to running state even the threads have completed their working successfully,

my threadPoolExecutor configuration is as follows,

queue size = 100
thread count = 5
max thread count = 10
keep alive time = 1 min

here is the thread dump but i didn’t understand what is says

java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x2808f538> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
    at java.util.concurrent.ArrayBlockingQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

Here is the code:

ReqtQueue = new ArrayBlockingQueue<Runnable>(100, true);
        notifTaskExecutor   = new ThreadPoolExecutor(
          5, // core size of threads that will remain in idle state
          10, // max size of thread that can be created
          1, // keep alive time for thread other than number of core threads when they are in idel state
          TimeUnit.MINUTES, // keep alive time units
          ReqtQueue // the queue to use
        );

And the excute method is called:

notifTaskExecutor.execute(new NotificationSender(request, name));

the NotificationSender just send the email and all code is in try catch and its very simple, and even when the run method is empty the thread is not terminated

help required

regards

  • 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-11T07:18:35+00:00Added an answer on June 11, 2026 at 7:18 am

    If you look at your thread dump, the threads are waiting on the task queue for more tasks. I.e this is the expected behavior.

    The JVM exits only when all non-daemon threads have terminated, and thread pool uses non daemon threads.

    You should call the shutdown() method on the Thread Pool to shut it down. You can call this method immediately after submitting tasks, as the already submitted task will be processed before shutting down (unlike the shutdownNow method).

    Alternatively, it is also possible to have a thread pool that uses daemon threads. These will automatically shutdown when the last non daemon thread exits.

    But in your case, you want I use the shutdown method. You can also call the awaitTermination method after calling shutdown to wait for your tasks to finish, in order to print a log message etc.

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

Sidebar

Related Questions

I have a shell script that launches a Maven exec:java process - exec mvn
So I have a process (java commandline application) that is hidden with the output
I have some automated functionality built into my web app that sends email daily
I have a java program that runs another (Python) program as a process. Process
I have a javaagent attached to a remote process using agentmain which sends serialized
I have a Java app that creates an external process and reads the process'
Java Socket Server I have a Java process that is creating a listener on
I already have Java code to display and process data from a database. I
I have a program with 2 process java : processA and processB ( 2
Hi i have requirement to process large number of files via multithreading in java.

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.