I don't think there's anything wrong with a System.exit(0) if it's at the
end of your program. You probably have at least one non-daemon thread
hanging around which is why the JVM won't terminate. No doubt this was
started by JTOpen and maybe should have been marked as a daemon thread.
FYI, the JVM will terminate only if all non-daemon threads have completed.
If a thread is marked as a daemon thread, it can still be active and the JVM
will terminate but if the thread is not marked as a daemon, the JVM will
wait for it to finish.

If you're using a debugger, it should be able to tell you what threads are
still around. Otherwise, you can try something like this which I haven't
tested:

Thread[] ta;
Thread.enumerate(ta);
for (int i = 0; i < ta.length; i++)
{
System.err.println("Thread " + i + " = " + ta[i] + "; daemon = " +
ta[i].isDaemon);
}

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On Behalf Of James Lampert
Sent: Thursday, May 01, 2008 12:27 PM
To: Java Programming on and around the iSeries / AS400
Subject: Re: JTOpen ProgramCall doesn't work

Gary L Peskin wrote:
It looks like you're getting to your "services disconnected" print
line.
Are you hanging after that line?

Evidently.

Could it perhaps be that some spawned-off thread is hanging? That the
exceptions I get with the trace turned on might have something to do
with the problem?

If I add a "System.exit(0)" call at the end, the program terminates, of
course, but I feel like that amounts to trying to thread a needle with
a
sledgehammer.

--
James H. H. Lampert
Touchtone Corporation

--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.