private void setCL ( final ClassLoader cl ) { PrivilegedAction < Object > action = new PrivilegedAction < Object > ( ) { @ Override @ FFDCIgnore ( SecurityException . class ) public Object run ( ) { final Thread t = Thread . currentThread ( ) ; try { t . setContextClassLoader ( cl ) ; } catch ( SecurityException e ) { // If this work happens to run on an java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread, // setting the ClassLoader may be rejected. If this happens, give a decent error message. if ( t instanceof ForkJoinWorkerThread && "InnocuousForkJoinWorkerThreadGroup" . equals ( t . getThreadGroup ( ) . getName ( ) ) ) { throw new SecurityException ( Tr . formatMessage ( tc , "cannot.apply.classloader.context" , t . getName ( ) ) , e ) ; } else { throw e ; } } return null ; } } ; AccessController . doPrivileged ( action ) ; }
Sets the provided classloader on the current thread .