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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:40:13+00:00 2026-05-26T22:40:13+00:00

In an open source application I’m participating, we’ve got a bug, where the application

  • 0

In an open source application I’m participating, we’ve got a bug, where the application doesn’t always close properly. That’s what I’d like to solve.

Experience has shown that this happens most of the time when threads and processes are being started, but not managed correctly (e.g. a thread is waiting on a socket connection, the application is being shut down and the thread keeps on waiting).
With this in mind I’ve searched for ‘.start()’ in the entire source and found 53 occurrences (which scared me a bit).
As a first step, I wanted to create a helper class (ThreadExecutor) where the current code ‘thread.start()’ would be replaced by ‘ThreadExecutor.Execute(thread)’ to have a) only a few changes in the existing source and b) a single class where I can easily check which threads don’t end as they should. To do this I wanted to

  • add the thread to be executed to a list called activeThreads when calling the Execute method
  • start the thread
  • remove it from the activeThreads list when it ends.

This way I’d have an up to date list of all executing threads and when the app hangs on shutdown I could see in there which thread(s) is(are) causing it.

Questions:

  • What do you think about the concept? I’m usually coding c# and know how I’d do it using .NET with workers, but am not too sure what’s best in Java (I’d like to modify as few lines of code as possible in the existing source).
  • If the concept seems ok, how can I get notified of a thread terminating. I’d like to avoid having an additional thread checking every once in a while what the state of all threads contained in activeThreads is, to remove them if they terminated.

Just to clarify: Before figuring out how to terminate the application properly, what I’m asking here is what’s the best/easiest way to find which threads are at cause for certain test cases which are pretty hard to reproduce.

  • 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-26T22:40:13+00:00Added an answer on May 26, 2026 at 10:40 pm

    Try to make all threads daemon(when all remaining threads are daemon the JVM terminates). Use thread.setDaemon(true) before starting each thread.

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

Sidebar

Related Questions

is there any kind of open source application that is sort of like a
There's an open source application that does queries like so: $db->query('SELECT item FROM table
I'm looking for a simple open source, or reference application that I could use
I've developed an open source application in php and mysql. I'd like to give
I have a project that is an open source application for a specific type
I am browsing the code of a large open source application and would like
I'm inspecting an open source web application. There's aproblem that it used error_get_last function
I want to create an open source application for Android that will be available
I am working on an open source web-based application that communicates with Facebook. One
Spring.NET is an open source application framework that makes building enterprise .NET applications easier.

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.