Class ScriptService

  • All Implemented Interfaces:, java.lang.AutoCloseable, ClusterStateApplier

    public class ScriptService
    extends java.lang.Object
    implements, ClusterStateApplier
    • Field Detail


        public static final Setting<java.lang.Integer> SCRIPT_CACHE_SIZE_SETTING

        public static final Setting<TimeValue> SCRIPT_CACHE_EXPIRE_SETTING

        public static final Setting<java.lang.Integer> SCRIPT_MAX_SIZE_IN_BYTES

        public static final Setting<Tuple<java.lang.Integer,​TimeValue>> SCRIPT_MAX_COMPILATIONS_RATE

        public static final Setting<java.util.List<java.lang.String>> TYPES_ALLOWED_SETTING

        public static final Setting<java.util.List<java.lang.String>> CONTEXTS_ALLOWED_SETTING
    • Constructor Detail

      • ScriptService

        public ScriptService​(Settings settings,
                             java.util.Map<java.lang.String,​ScriptEngine> engines,
                             java.util.Map<java.lang.String,​ScriptContext<?>> contexts)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface
      • compile

        public <FactoryType> FactoryType compile​(Script script,
                                                 ScriptContext<FactoryType> context)
        Compiles a script using the given context.
        a compiled script which may be used to construct instances of a script for the given context
      • isLangSupported

        public boolean isLangSupported​(java.lang.String lang)
      • isTypeEnabled

        public boolean isTypeEnabled​(ScriptType scriptType)
      • isContextEnabled

        public boolean isContextEnabled​(ScriptContext scriptContext)
      • isAnyContextEnabled

        public boolean isAnyContextEnabled()
      • applyClusterState

        public void applyClusterState​(ClusterChangedEvent event)
        Description copied from interface: ClusterStateApplier
        Called when a new cluster state (ClusterChangedEvent.state() needs to be applied. The cluster state to be applied is already committed when this method is called, so an applier must therefore be prepared to deal with any state it receives without throwing an exception. Throwing an exception from an applier is very bad because it will stop the application of this state before it has reached all the other appliers, and will likely result in another attempt to apply the same (or very similar) cluster state which might continue until this node is removed from the cluster.
        Specified by:
        applyClusterState in interface ClusterStateApplier