Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Thread.stop() deprecation


  • From: Samuel.Caro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Caro, Samuel)
  • Subject: Thread.stop() deprecation
  • Date: Mon, 28 Feb 2000 14:36:19 -0600

// Description of changes are in commnets

public class MyClass extends Frame implements ActionListener{
   
   public void doIt() {
      ...
         Thread threadList = new Thread((OtherClass)panList);
      threadList.start();
      ...
         
      // S. Caro :: Change the following line 
         // stopRequested = true;  //want the thread to stop
      // to
      ((OtherClass)panList).stop();  // Must be the instance of the
OtherClass

   }
}

class OtherClass extends Panel impplements Runnable, ActionListener{

   // S. Caro :: Moved the variable to this class
   private boolean stopRequested;

   public void run() {
      while(!stopRequested) {
         ...
      }
   }

   // S. Caro :: Added Method
   public void stop(){
      stopRequested = true;
   }

}


> ----------
> From: 	Salome Harrison[SMTP:salomeharrison@xxxxxxxxx]
> Sent: 	Monday, February 28, 2000 2:18 PM
> To: 	Advanced Java
> Subject: 	Thread.stop() deprecation
> 
> Hi all,
> 
> I am trying to modify someone's existing code to take
> care of the Thread.stop deprecation.  I am having
> trouble getting it to work.  I get a compilation error
> saying that stopRequested is undefined in the second
> class (OtherClass).  Here is the structure:
> 
> public class MyClass extends Frame implements
> ActionListener {
> 
>  private boolean stopRequested;
> 
>  public void doIt() {
>   ...
>   Thread threadList = new Thread((OtherClass)panList);
>   threadList.start();
>   ...
>   stopRequested = true;  //want the thread to stop
>  }
> }
> class OtherClass extends Panel impplements Runnable,
> ActionListener {
> 
>  public void run() {
>   while(!stopRequested) {
>    ...
>   }
>  }
> }
> 
> Please help!
> 
> -Salome
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
> 
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
> 

---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx