Re: When the stop() in Thread class changed to final method?



In article <epup7l$4o0$1@xxxxxxxxxxxxxxxxxx>, Rogan Dawes
<discard@xxxxxxxxxxxx> wrote:
RC wrote:
Daniel Pitts wrote:
On Feb 1, 7:27 am, RC <raymond.c...@xxxxxxxxxxxxxxx> 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
.



Relevant Pages

  • Re: ADFS June 2006 Step-by-step guide
    ... One of those tabs is called "resource accounts". ... the incoming user's UPN must map to a UPN in ... UPN will be used create the windows token. ... claims mappings showing up in the UI of the claims app. ...
    (microsoft.public.windows.server.active_directory)
  • Re: ADFS June 2006 Step-by-step guide
    ... I am trying to work with the step-by-step guide. ... I went back to seeing how a claims-based app can work and I have abandoned ... Infact, on the resource server's fs settings, I went to where I ... this DOESN'T actually make ADFS work on your machine. ...
    (microsoft.public.windows.server.active_directory)
  • Re: ADFS - Not Authorized To View Message
    ... For your token app, are you trying to map the ADFS token to a user in the ... store of the resource partner itself, you can't map based on groups. ... shadow accounts, do both but try shadow accounts first, do both but try ...
    (microsoft.public.windows.server.active_directory)
  • Re: ADFS June 2006 Step-by-step guide
    ... alansh@xxxxxxxxxx in the resource forest. ... ADFS to map to a specific user in your forest or if you want a token based ... The claims app will help you debug all this stuff and the quick start sample ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)
  • Re: ADFS
    ... you were right about the slash, it was missing on the resource side. ... have the resource application properly configured in IIS for SSL. ... Sometimes it is helpful to configure the app with a simple test page like ... Co-author of "The .NET Developer's Guide to Directory Services ...
    (microsoft.public.windows.server.active_directory)