#4 graceful termination for JConsole

open
nobody
None
5
2004-04-14
2004-04-14
Barak Naveh
No

Many thanks for BeanShell - I'm using it for years and
very satisfied.

A problem that bugs me for ages is that JConsole
doesn't terminates gracefully. The inpipe watcher
thread is hanging there and prevents the application
termination. System.exit() is required to force
termination.

Attached is a source with a fix to the problem:

In constructor JConsole#JConsole(InputStream,
OutputStream) just before the end, there is thread
allocation.

Before:
// Start the inpipe watcher
new Thread( this ).start();

After:
// Start the inpipe watcher
Thread thread = new Thread( this );
thread.setDaemon(true);
thread.start();

As daemon thread, the inPipe Watcher doesn’t get in the
way when all other threads are ready to terminate.

regards,
Barak Naveh

Discussion

  • Barak Naveh
    Barak Naveh
    2004-04-14

     
    Attachments