Article View: borland.public.jbuilder.java.language
Article #19052Re: thread and variables
From: Greg Dickson
Date: Wed, 18 Mar 1998 00:00
Date: Wed, 18 Mar 1998 00:00
39 lines
1676 bytes
1676 bytes
Thanks James
Good point
probably a good way to clean up the threads in the close program
sequence too. TobesureTobesureTobesure
Greg
James Rudnicki wrote in message <6elcmn$pqb6@forums.borland.com>...
>
>Greg Dickson wrote in message <6ej7rq$nmb1@forums.borland.com>...
>>if I start a thread from a method with say
>>
>>private void doCommand (String doThis) {
>>
>>RunCommand tc = new RunCommand(doThis);
>>
>>What happens if the method is called several times
>
>
>Well, tc gets the new reference to the object each time the method is
>called, but I would worry about the garbage collector. When you
create the
>new instance, the reference to the old instance becomes unused. What
has a
>reference to the old and still executing thread? Nothing, so the
garbage
>collector might try to clean up thereby ruining the data members.
>
>You may get lucky because an event listener could have a reference
and keep
>the instance alive, but...
>
>Maybe keep all the references on a Stack or Vector.
>
>bye
>
>
>
Technical Details
Message-ID:
<6emqqb$rce3@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6ej7rq$nmb1@forums.borland.com> <6elcmn$pqb6@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ddaf1f759f6f1855 X-Google-Attributes: gidf74b3,public From: "Greg Dickson" <witchy@netserv.net.au> Subject: Re: thread and variables Date: 1998/03/18 Message-ID: <6emqqb$rce3@forums.borland.com> X-Deja-AN: 335021496 Content-Transfer-Encoding: 7bit References: <6ej7rq$nmb1@forums.borland.com> <6elcmn$pqb6@forums.borland.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language