Class GremlinExecutor.Builder
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.Builder
-
- Enclosing class:
- GremlinExecutor
public static final class GremlinExecutor.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GremlinExecutor.Builder
addPlugins(String engineName, Map<String,Map<String,Object>> plugins)
Add a configuration for aGremlinPlugin
to the executor.GremlinExecutor.Builder
afterFailure(BiConsumer<Bindings,Throwable> afterFailure)
AConsumer
to execute in the event of failure.GremlinExecutor.Builder
afterSuccess(Consumer<Bindings> afterSuccess)
AConsumer
to execute just after successful script evaluation.GremlinExecutor.Builder
afterTimeout(Consumer<Bindings> afterTimeout)
AConsumer
to execute if the script times out.GremlinExecutor.Builder
beforeEval(Consumer<Bindings> beforeEval)
AConsumer
to execute just before the script evaluation.GremlinExecutor
create()
GremlinExecutor.Builder
evaluationTimeout(long evaluationTimeout)
Amount of time an evaluation has before it times out.GremlinExecutor.Builder
executorService(ExecutorService executorService)
The thread pool used to evaluate scripts.GremlinExecutor.Builder
globalBindings(Bindings bindings)
Bindings to apply to every script evaluated.GremlinExecutor.Builder
scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
The thread pool used to schedule timeouts on scripts.
-
-
-
Method Detail
-
addPlugins
public GremlinExecutor.Builder addPlugins(String engineName, Map<String,Map<String,Object>> plugins)
Add a configuration for aGremlinPlugin
to the executor. The key is the fully qualified class name of theGremlinPlugin
instance and the value is a map of configuration values. In that map, the key is the name of a builder method on theGremlinPlugin
and the value is some argument to pass to that method.
-
globalBindings
public GremlinExecutor.Builder globalBindings(Bindings bindings)
Bindings to apply to every script evaluated. Note that the entries of the suppliedBindings
object will be copied into a newly createdConcurrentBindings
object at the call of this method.
-
evaluationTimeout
public GremlinExecutor.Builder evaluationTimeout(long evaluationTimeout)
Amount of time an evaluation has before it times out. Note that the time required covers both evaluation as well as any time needed for a post result transformation (if the transformation function is supplied to theGremlinExecutor.eval(java.lang.String)
).- Parameters:
evaluationTimeout
- Time in milliseconds that an evaluation is allowed to run and its results potentially transformed. Set to zero to have no timeout set.
-
executorService
public GremlinExecutor.Builder executorService(ExecutorService executorService)
The thread pool used to evaluate scripts.
-
scheduledExecutorService
public GremlinExecutor.Builder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
The thread pool used to schedule timeouts on scripts.
-
beforeEval
public GremlinExecutor.Builder beforeEval(Consumer<Bindings> beforeEval)
AConsumer
to execute just before the script evaluation.
-
afterSuccess
public GremlinExecutor.Builder afterSuccess(Consumer<Bindings> afterSuccess)
AConsumer
to execute just after successful script evaluation. Note that success will be called after evaluation of the script in the engine and after the results have passed through transformation (if a transform function is passed to theGremlinExecutor.eval(java.lang.String)
.
-
afterTimeout
public GremlinExecutor.Builder afterTimeout(Consumer<Bindings> afterTimeout)
AConsumer
to execute if the script times out.
-
afterFailure
public GremlinExecutor.Builder afterFailure(BiConsumer<Bindings,Throwable> afterFailure)
AConsumer
to execute in the event of failure.
-
create
public GremlinExecutor create()
-
-