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
SCJP2 (93%),SCWCD(88%)<br />-------------------------------<br />Never under estimate yr self, just represent yr profile in proper manner.
George Brown
Ranch Hand
Joined: Sep 26, 2000
Posts: 919
posted
0
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
Joined: Feb 28, 2002
Posts: 81
posted
0
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
Joined: Sep 26, 2000
Posts: 919
posted
0
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 ]