Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2266
| Newsgroups | comp.lang.java.help |
|---|---|
| Date | 2012-11-15 10:56 -0800 |
| References | <b18cadc9-199f-4900-9f44-b25ec90acbd4@googlegroups.com> <k836e1$l25$1@dont-email.me> <b571f064-315f-4fb5-81fc-b850984727d7@googlegroups.com> <k83chd$tmt$1@dont-email.me> |
| Message-ID | <286880a2-9d51-45a5-892a-1bad72e69ad9@googlegroups.com> (permalink) |
| Subject | Re: Please help me kill this java thread..... code example |
| From | kedward777@gmail.com |
Thank you again! I think you are right about the a lock on the JVM by the scanner thread.
One key point is that I am also tried setting the "exiting" variable in the shutdown method, which should stop the while loop of the scanner thread... but I don't think the thread is being woken in the shutdown, BUT then when I press the scan trigger, it wakes the thread and it sees that exiting is true, and THEN dies...
private void shutdown(java.awt.event.ActionEvent evt) {
existing=true;
System.exit(0);
}
QUESTION: how do I wake the scanner thread from the event thread (shutdown) ... I tried notifyAll(), but I get an exception:
java.lang.IllegalMonitorStateException: current thread not owner
>
> Okay: I've come up with a fourth guess. Perhaps exit() has in
> fact been called (and allowed), and the JVM is in the process of
> shutting down. But perhaps shutdown cannot complete while the scanner
> code holds a lock or other resource (JNI?) that the JVM's shutdown
> needs before shutdown can complete. Firing the scanner one last time
> might jar things loose. (Remember: This is still just a guess.)
>
> The scanner code (in another thread you called it "the motorola
> sample program") is not known to me, so I can't say what it might be
> hanging on to. Knute Johnson's suggestion of interrupting the thread
> might work, if the code is well-behaved (and doesn't, for example,
> just catch and ignore exceptions); I'd suggest giving it a try. If
> that doesn't help -- well, you say you're using NetBeans, which means
> you have a debugger available; have you used it to find out what the
> threads are doing instead of exiting?
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Please help me kill this java thread..... code example kedward777@gmail.com - 2012-11-15 07:06 -0800
Re: Please help me kill this java thread..... code example kedward777@gmail.com - 2012-11-15 07:09 -0800
Re: Please help me kill this java thread..... code example Knute Johnson <nospam@knutejohnson.com> - 2012-11-15 08:42 -0800
Re: Please help me kill this java thread..... code example Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-11-15 11:49 -0500
Re: Please help me kill this java thread..... code example kedward777@gmail.com - 2012-11-15 10:16 -0800
Re: Please help me kill this java thread..... code example Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-11-15 13:33 -0500
Re: Please help me kill this java thread..... code example kedward777@gmail.com - 2012-11-15 10:56 -0800
Re: Please help me kill this java thread..... code example Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-11-15 14:21 -0500
Re: Please help me kill this java thread..... code example Roedy Green <see_website@mindprod.com.invalid> - 2012-11-15 13:37 -0800
csiph-web