• Post Reply Bookmark Topic Watch Topic
  • New Topic

checkAccess() method of Thread Class !  RSS feed

 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,
Please tell me, how checkAccess method (of Java.Lang.Thread class)will work !
It will check Access on which Thread/Variable and For which Thread ?
It is the best, if anybody can give explanation with one small example.
Dharmin
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read up on security policies, the SecurityManager class and its checkAccess() method. You should then be able to answer your own question.
And it checks whether the currently running thread can modify the thread that the checkAccess() message is sent to.
[ May 29, 2002: Message edited by: George Brown ]
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But george the method is void and not returning anything.
How the running thread intimateed (where i hv written this message) that for the called Thread (Thread to which the message goes to)it is eligible ?
Please reply with some example if possible !
Thanks in advanced.
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the javadoc:
Throws:
SecurityException - if the current thread is not allowed to access this thread.
As you asked, here's a code snippet:
I wouldn't find much use for the checkAccess() method myself though as the Thread methods that need access would call the checkAccess method on the SecurityManager anyway and throw the SecurityException themselves if access is disallowed. For example stop, suspend, resume, setPriority, setName, and setDaemon will all check whether they have access themselves.
[ May 29, 2002: Message edited by: George Brown ]
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats gr8 , Brown thanks!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!