Github user robertdale commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/570#discussion_r105750603 --- Diff: gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java --- @@ -149,19 +159,64 @@ } }; + private GremlinGroovyClassLoader loader; + /** * Script to generated Class map. */ - private ManagedConcurrentValueMap<String, Class> classMap = new ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle()); + private final LoadingCache<String, Future<Class>> classMap = Caffeine.newBuilder(). + softValues(). + recordStats(). + build(new CacheLoader<String, Future<Class>>() { + @Override + public Future<Class> load(final String script) throws Exception { + final long start = System.currentTimeMillis(); + + return CompletableFuture.supplyAsync(() -> { + try { + return loader.parseClass(script, generateScriptName()); + } catch (CompilationFailedException e) { + final long finish = System.currentTimeMillis(); + log.error("Script compilation FAILED {} took {}ms {}", script, finish - start, e); + failedCompilationCount.incrementAndGet(); --- End diff -- I'm not sure how to trigger this. I can't get `gremlin-groovy.sessionless.class-cache.load-failure-count` to increment. Tried `curl "http://localhost:8182?gremlin=g.V().beavis()"` and ``` :remote connect tinkerpop.server conf/remote.yaml :> g.V().beavis() ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---