Code example for AccessControlContext

0
 
    public static void main(String[] args) throws Exception {
 
        ProtectionDomain domain = new ProtectionDomain(null, null);
 
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
            public Object run() {
 
                // this initialize ProxyLazyValues 
                UIManager.getLookAndFeel(); 
 
                return null; 
            } 
        }, new AccessControlContext(new ProtectionDomain[]{domain}));
 
        weakRef = new WeakReference<ProtectionDomain>(domain);
        domain = null;
 
        Util.generateOOME(); 
 
        if (weakRef.get() != null) {