• Post Reply Bookmark Topic Watch Topic
  • New Topic

Commenting lines in Java policy file

 
Amarnath Vadivelu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In the java policy file what will happen if we comment out

//permission java.lang.RuntimePermission "stopThread";.


My understanding is that we can't call thread.stop() anywhere in the program am i rite?
If we call it should say "Access denied"... But we should be able to work on with thread.start and thread.run


If any Text area is built with AWT closing it by clicking on "X" on the window will call this thread.stop() method?
 
Tony Docherty
Saloon Keeper
Posts: 3155
75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This permission only allows code to stop a thread if it has previously been granted permission to access that thread.
However, you shouldn't be calling the stop() method on a Thread anyway. The method was deprecated years ago because it is inherently unsafe and can cause bugs which are horribly difficult to trace. Consequently you should never grant this permission.

Closing an AWT window doesn't call stop() on any thread as far as I'm aware.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!