< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java

Print this page

        

*** 52,66 **** * A code cache for persistent caching of compiled scripts. */ @Logger(name="codestore") public abstract class CodeStore implements Loggable { - /** - * Permission needed to provide a CodeStore instance via ServiceLoader. - */ - public final static String NASHORN_PROVIDE_CODE_STORE = "nashorn.provideCodeStore"; - private DebugLogger log; /** * Constructor */ --- 52,61 ----
*** 83,109 **** * * @param context the current context * @return The instance, or null if code store could not be created */ public static CodeStore newCodeStore(final Context context) { - final Class<CodeStore> baseClass = CodeStore.class; - try { - // security check first - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission(NASHORN_PROVIDE_CODE_STORE)); - } - final ServiceLoader<CodeStore> services = ServiceLoader.load(baseClass); - final Iterator<CodeStore> iterator = services.iterator(); - if (iterator.hasNext()) { - final CodeStore store = iterator.next(); - store.initLogger(context).info("using code store provider ", store.getClass().getCanonicalName()); - return store; - } - } catch (final AccessControlException e) { - context.getLogger(CodeStore.class).warning("failed to load code store provider ", e); - } try { final CodeStore store = new DirectoryCodeStore(context); store.initLogger(context); return store; } catch (final IOException e) { --- 78,87 ----
< prev index next >