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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:25:10+00:00 2026-06-17T03:25:10+00:00

I saw some posts on stackoverflow and read through the tutorials that oracle posted

  • 0

I saw some posts on stackoverflow and read through the tutorials that oracle posted on destroying threads. From what I understand, once you start() a thread, you cannot use stop() to remove that thread. Instead of actually removing the thread from the scheduler, it is recommended to make the thread sleep() indefinitely. Is this thinking right?

Also this brings me to my next question, is this why people use thread pools?. Instead of “sleeping” a thread, it is more resourceful to use that thread to work on other jobs rather than creating new threads. Please let me know if my understanding of multi-thread management is right. It doesn’t make sense that Java doesn’t allow for a thread to be completely removed in a safe manner.

  • 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-17T03:25:11+00:00Added an answer on June 17, 2026 at 3:25 am

    It is generally considered a very bad idea to forcibly stop a thread once it has started (or to make it sleep indefinitely) because the thread will not be able to clean up any of the resources it has acquired. For example, if a thread acquired a lock and is forcibly killed or slept indefinitely, then the lock will not be released and deadlock can ensue. Similarly, if the thread was making changes to a data structure and killed early, the data structure might be in a corrupted state, causing serious problems later on.

    The best way to stop a thread in Java is to interrupt the thread and tell it that it needs to try to shut down as soon as possible. That way, the thread can try to stop what it’s doing and release any resources before shutting down. In other words, you request that the thread shut down, rather than forcibly killing it.

    This is not related to why thread pools exist. Thread pools are useful because there is usually some overhead associated with creating or destroying threads, due to the internal JVM or OS-level bookkeeping required to track the thread’s state and progress. Thread pools make it possible to recycle threads and have them perform different tasks by having the threads sleep until a task is ready, then wake up and perform the task. This can be much faster than spawning off a new thread, performing the task yourself, then tearing down the thread.

    Hope this helps!

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

Sidebar

Related Questions

I saw some previous posts related to opening a file to perform read and
I saw on some SO posts that to shuffle arrays, you would use php's
I saw some websites that (for example): if you want to view your message
I saw some html that displays the results of a PHP code just by
I saw some scala code that assign _ to a field of class, what
I have looked into a few posts and saw some related posts on it
I was reading some posts about closures and saw this everywhere, but there is
I saw similar posts but some weren't clear. Here is the repeater head: <asp:Repeater
I saw some code when studying the open source project: here . But I
I saw some handwarmer apps and I guess it's very easy to make something

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.