Class GremlinGroovyScriptEngine

  • All Implemented Interfaces:
    Compilable, Invocable, ScriptEngine, GremlinScriptEngine

    public class GremlinGroovyScriptEngine
    extends org.codehaus.groovy.jsr223.GroovyScriptEngineImpl
    implements GremlinScriptEngine
    Provides methods to compile and evaluate Gremlin scripts. Compiled scripts are stored in a managed cache to cut down on compilation times of future evaluations of the same script. This ScriptEngine implementation is heavily adapted from the GroovyScriptEngineImpl to include some additional functionality.
    Author:
    Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
    See Also:
    GremlinExecutor
    • Constructor Detail

      • GremlinGroovyScriptEngine

        public GremlinGroovyScriptEngine()
        Creates a new instance using no Customizer.
      • GremlinGroovyScriptEngine

        public GremlinGroovyScriptEngine​(Customizer... customizers)
    • Method Detail

      • getPlugins

        public Set getPlugins()
        Get the list of loaded plugins.
      • reset

        public void reset()
        Resets the entire GremlinGroovyScriptEngine by clearing script caches, recreating the classloader, clearing bindings.
      • createBindings

        public Bindings createBindings()
        Create bindings to be used by this ScriptEngine. In this case, SimpleBindings are returned.
        Specified by:
        createBindings in interface ScriptEngine
        Overrides:
        createBindings in class org.codehaus.groovy.jsr223.GroovyScriptEngineImpl
      • getInterface

        public <T> T getInterface​(Class<T> clazz)
        Specified by:
        getInterface in interface Invocable
        Overrides:
        getInterface in class org.codehaus.groovy.jsr223.GroovyScriptEngineImpl
      • getInterface

        public <T> T getInterface​(Object thiz,
                                  Class<T> clazz)
        Specified by:
        getInterface in interface Invocable
        Overrides:
        getInterface in class org.codehaus.groovy.jsr223.GroovyScriptEngineImpl
      • getClassCacheLongRunCompilationCount

        public long getClassCacheLongRunCompilationCount()
        Gets the number of compilations that extended beyond the expectedCompilationTime.
      • getClassCacheEstimatedSize

        public long getClassCacheEstimatedSize()
        Gets the estimated size of the class cache for compiled scripts.
      • getClassCacheAverageLoadPenalty

        public double getClassCacheAverageLoadPenalty()
        Gets the average time spent compiling new scripts.
      • getClassCacheEvictionCount

        public long getClassCacheEvictionCount()
        Gets the number of times a script compiled to a class has been evicted from the cache.
      • getClassCacheEvictionWeight

        public long getClassCacheEvictionWeight()
        Gets the sum of the weights of evicted entries from the class cache.
      • getClassCacheHitCount

        public long getClassCacheHitCount()
        Gets the number of times cache look up for a compiled script returned a cached value.
      • getClassCacheHitRate

        public double getClassCacheHitRate()
        Gets the hit rate of the class cache.
      • getClassCacheLoadCount

        public long getClassCacheLoadCount()
        Gets the total number of times the cache lookup method attempted to compile new scripts.
      • getClassCacheLoadFailureCount

        public long getClassCacheLoadFailureCount()
        Gets the total number of times the cache lookup method failed to compile a new script.
      • getClassCacheLoadFailureRate

        public double getClassCacheLoadFailureRate()
        Gets the ratio of script compilation attempts that failed.
      • getClassCacheLoadSuccessCount

        public long getClassCacheLoadSuccessCount()
        Gets the total number of times the cache lookup method succeeded to compile a new script.
      • getClassCacheMissCount

        public long getClassCacheMissCount()
        Gets the total number of times the cache lookup method returned a newly compiled script.
      • getClassCacheMissRate

        public double getClassCacheMissRate()
        Gets the ratio of script compilation attempts that were misses.
      • getClassCacheRequestCount

        public long getClassCacheRequestCount()
        Gets the total number of times the cache lookup method returned a cached or uncached value.
      • getClassCacheTotalLoadTime

        public long getClassCacheTotalLoadTime()
        Gets the total number of nanoseconds that the cache spent compiling scripts.
      • getParentLoader

        protected ClassLoader getParentLoader()