🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Linda Thu, 08 Mar 2007 19:21
Re: When the stop() in Thread class changed to final method?
#75387
Author: Linda
Date: Thu, 08 Mar 2007 19:21
91 lines
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.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads