• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

start stop init destroy

 
Randall Twede
Ranch Hand
Posts: 4363
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im as confused about this now as i was 11 years ago. i created an applet that started a thread to scroll some text in an infinite while loop. i was concerned about this thread continuing to run after the page was left so i wrote this:


even then the API said stop, suspend,resume, and destroy methods of Thread class were deprecated.

is stopping that thread something i should do something about? or can i just delete most of that code i just posted?

according to the current API(like the old one) i should do something. here are some quotes:

public void start()
A subclass of Applet should override this method if it has any operation that it wants to perform each time the Web page containing it is visited. For example, an applet with animation might want to use the start method to resume animation, and the stop method to suspend the animation.

public void stop()
A subclass of Applet should override this method if it has any operation that it wants to perform each time the Web page containing it is no longer visible. For example, an applet with animation might want to use the start method to resume animation, and the stop method to suspend the animation.

public void destroy()
A subclass of Applet should override this method if it has any operation that it wants to perform before it is destroyed. For example, an applet with threads would use the init method to create the threads and the destroy method to kill them.

notice how they use the words suspend, resume, and destroy method to kill?

so are they just trying to make me lose more of my hair?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic