ProtectionDomain getProtectionDomainForProxy ( ProtectionDomain domain ) { if ( domain . getCodeSource ( ) == null ) { // no codesource to cache on return create ( domain ) ; } ProtectionDomain proxyProtectionDomain = proxyProtectionDomains . get ( domain . getCodeSource ( ) ) ; if ( proxyProtectionDomain == null ) { // as this is not atomic create() may be called multiple times for the same domain // we ignore that proxyProtectionDomain = create ( domain ) ; ProtectionDomain existing = proxyProtectionDomains . putIfAbsent ( domain . getCodeSource ( ) , proxyProtectionDomain ) ; if ( existing != null ) { proxyProtectionDomain = existing ; } } return proxyProtectionDomain ; }
Gets an enhanced protection domain for a proxy based on the given protection domain .