doPrivileged()
is required in cases where there is application code on the stack frame accessing the system resources (ie, read/write files, opening ports, and etc). This class also improve performance no matther Security Manager is being enabled or not. Note: This utility should be used properly, otherwise might introduce security holes. Usage Example: public void changePassword() { ... AccessController.doPrivileged(new PrivilegedAction() { public Object run() { f = Util.openPasswordFile(); ... } }); ... }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|