Article View: news.software.nntp
Article #75387Re: When the stop() in Thread class changed to final method?
From: Linda
Date: Thu, 08 Mar 2007 19:21
Date: Thu, 08 Mar 2007 19:21
91 lines
4598 bytes
4598 bytes
In article <epup7l$4o0$1@ctb-nnrp2.saix.net>, Rogan Dawes <discard@dawes.za.net> wrote: >RC wrote: >> Daniel Pitts wrote: >>> On Feb 1, 7:27 am, RC <raymond.c...@nospam.noaa.gov> wrote: >>>> If you go to this link >>>> >>>> http://java.sun.com/j2se/1.5.0/docs/guide/misc/threadPrimitiveDepreca... >> >>> >>> That document you linked to is suggesting that you override the stop >>> method in Applet, not Thread. >> >> Then, do you know how I can stop a thread since Thread.stop() >> has deprecated. Can I just make a thread = null? Stopping a thread is just the worst possible thing you can imagine. In many cases, you'll simply crash you entire app if you don't catch that exception in the right place. Thread should be stopped by exiting it main run() loop. The simpliest thing is to set some variable that is tested in the run loop. That variable could be set by just about any method or a result of some user action, such as "cancel" or from some event handler code. But when you simply slaugher thread with stop(), there may be all sorts of things happening in your app, things may be locked, some other threads may be waiting for some operation to complete, and so on. Because once you even utter the word "thread", it implies theare are other threads in your app, and they all should coordinate the access to common resources, such as files, sockets, gui elements or you name it. So... What you are creating by doing that stop() thing, is making your entire app inconsistent, when one part thinks that it has a valid access to some variable or resource, but the other part, sitting on the same resource is dead. You'll never make your program stable. That is for sure. Just about all you can achive with it is an ugly hack. My suggestion is to completely forget this idea, because exiting thread properly is about the simpliest thing in the world, at least in most cases. And make sure that if that thread is associated with some frame in your app, you first exit thread, and then make sure to close that frame by doing dispose(). This way, your entire program's logic will operate as intuitively expected by the user. Good luck. >Did you not read the link that YOU provided above? > >It has all the advice and examples you need to answer that question. > >Rogan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [NWO, Zionism, war crimes, murder, torture, genocide, extermination, Illuminati] Intelligence Briefs It was Mossad who taught BOSS the more sophisticated means of interrogation that had worked for the Israelis in Lebanon: sleep deprivation, hooding, forcing a suspect to stand against a wall for long periods, squeezing genitalia and a variety of mental tortures including mock executions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is just a reminder. It is not an emergency yet. Were it actual emergency, you wouldn't be able to read this. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Technical Details
Message-ID:
<fc78ec4b.81239055@yahoo.com.au>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!novia!feeder.news-service.com!newsfeed.freenet.de!news2.wnet.ua!news2.lucky.net!lucky.net!news1.lucky.net!carrier.kiev.ua!news.te.net.ua!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!130.81.64.211.MISMATCH!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!760c3fd9!harvard.edu!smallerReferences:
<ept0sr$o2q$1@news.nems.noaa.gov> <1170358168.234067.21860@h3g2000cwc.googlegroups.com> <eptnpp$16f$1@news.nems.noaa.gov> <epup7l$4o0$1@ctb-nnrp2.saix.net>Show Full Headers
Complete Article Headers
Message-ID: <fc78ec4b.81239055@yahoo.com.au> Subject: Re: When the stop() in Thread class changed to final method? Date: Thu, 8 Mar 2007 19:21:31 GMT From: smaller@harvard.edu (Linda) References: <ept0sr$o2q$1@news.nems.noaa.gov> <1170358168.234067.21860@h3g2000cwc.googlegroups.com> <eptnpp$16f$1@news.nems.noaa.gov> <epup7l$4o0$1@ctb-nnrp2.saix.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!novia!feeder.news-service.com!newsfeed.freenet.de!news2.wnet.ua!news2.lucky.net!lucky.net!news1.lucky.net!carrier.kiev.ua!news.te.net.ua!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!130.81.64.211.MISMATCH!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!760c3fd9!harvard.edu!smaller Newsgroups: news.groups, alt.slack, alt.config, news.software.nntp, alt.usenet.kooks alt.usenet.kooks Organization: Yer Guidelines Stink Lines: 91 NNTP-Posting-Host: d14-75.tenet.odessa.ua X-Trace: toster.te.net.ua 1173401784 771 195.138.75.14 (9 Mar 2007 00:56:24 GMT) X-Complaints-To: abuse@te.net.ua NNTP-Posting-Date: Fri, 9 Mar 2007 00:56:24 +0000 (UTC) X-Newsreader: Microsoft Outlook Express 4.72.3110.1