• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.exit(0) in destroy()

 
Sam Cala
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Getting a problem. Usually in destroy() method, we people free all the resources that were in use by the applet and then closes the JVM by calling System.exit(0). But then, its raising a security exception ??
If I dont call System.exit(0), then there is no exception, but I have several threads running in applet, so in destroy I wanna kill the thread.
Consider this :
I have a chat applet running. Now for every user that connects to the chat applet, the applet creates a new thread. When one of the client wishes to leave the chat applet, I wanna kill the thread for that particular client. How this is going to achieve. Kindly help. !!!
Regards & all the best,
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in your destory method of applet just check if the running thread is not null and then just set it to nul it's a nice way to do it. It will kill your thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic