🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19036

Re: thread and variables

#19036
From: James Rudnicki
Date: Tue, 17 Mar 1998 00:00
24 lines
1294 bytes

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: <6elcmn$pqb6@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6ej7rq$nmb1@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: "James Rudnicki" <rudnicki@best.com>
Subject: Re: thread and variables
Date: 1998/03/17
Message-ID: <6elcmn$pqb6@forums.borland.com>
X-Deja-AN: 334831071
References: <6ej7rq$nmb1@forums.borland.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language