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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:35:31+00:00 2026-05-23T07:35:31+00:00

In our web-app we are using Launcher to call some command line functions (not

  • 0

In our web-app we are using Launcher to call some command line functions (not my idea) and see the result. This is more or less what we do:

ClassWorld classWorld = new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader());
Launcher launch = new Launcher();
launch.setWorld(classWorld);
result = launch.mainWithExitCode(sArguments);

Well, I recently learned that since mainWithExitCode is a static function it probably doesn’t do what I thought it did. So next version is probably going to be just:

Launcher launch = new Launcher();
result = launch.mainWithExitCode(sArguments);

So, we have been testing our app and it seems it leaks due to a lot of stuff I don’t really understand completely. So one senior from here (but not from our project) told us that it’s probably due to CommandLineUtils using addShoutDownHook that ‘transfers’ (that is probably not the best word for it) the object to java.lang.ApplicationShutdownHooks and it doesn’t destroy the object while the server is up (mostly all the time). So every command line that our web-app throws out of the blue it sticks in memory in he server, never cleaning.

So, I have been told that I should look for my process in the waitFor and quit it from the ShutdownHook. Seeing my code it does seem complicated at last to do that, since I don’t call the CommandLineUtils directly (I suppose it is called inside the launch method).

Does anybody have any clue on where I can find the info to develop this? I am not asking you to post some code that solves the problem (although it would be great), but to point me to some page or manual were I can find the info to solve this. Time is not yet a big issue (I have probably a week or so to find out and solve this), so I can spend some time reading manuals and such (and learn how to do it for the next time).

Any help would be appreciated.
Thanks!

  • 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-23T07:35:31+00:00Added an answer on May 23, 2026 at 7:35 am

    Yes addShutdownHook leaks hard, very hard. You have to use removeShutdownHook and even then the ThreadGroup might leak due to a bug.

    Actually web-apps should not touch threads at all unless: you are well settled w/ the server and have enough skills to make thread spawning, joining and killing it properly.

    That implies you do have plenty of skills to write middleware yourself and most likely you’d deploy the needed Threading code separately as JMX or JCA.

    My recommendation is: extract the service out of the web-app and deal it accordingly. Writing middleware w/o leaks takes quite a bit of skill and patience.

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

Sidebar

Related Questions

My team is considering building our next web app using the ASP.NET MVC framework.
We are experiencing some slowdowns on our web-app deployed on a Tomcat 5.5.17 running
For some reason every 3-5 days our web app loses the ability to open
We are using SVG in our web app and we need to allow users
We are using sendmail to send mails from our web app and we do
We're currently developing a J2EE web app using JPA as our data access layer.
We've been working on implementing timezone support for our Web app. This great SO
We are using Rails 3.0.X and running our web app on Heroku. We are
We have a popular web-app developed using CodeIgniter. Now we want to expose our
In our web-app we use PHP5.2.6 + PDO to connect to a SQL Server

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.