You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/05/28 15:21:48 UTC
incubator-tinkerpop git commit: Simplify the constructor on
GremlinExecutor.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master ac9bb03a7 -> 27cb6ba31
Simplify the constructor on GremlinExecutor.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/27cb6ba3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/27cb6ba3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/27cb6ba3
Branch: refs/heads/master
Commit: 27cb6ba31a40991896ada9e9a205d16582a59d38
Parents: ac9bb03
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 28 09:21:26 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 28 09:21:26 2015 -0400
----------------------------------------------------------------------
.../gremlin/groovy/engine/GremlinExecutor.java | 40 +++++++++-----------
1 file changed, 18 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/27cb6ba3/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 5351275..7489b22 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -94,25 +94,21 @@ public class GremlinExecutor implements AutoCloseable {
private final boolean suppliedExecutor;
private final boolean suppliedScheduledExecutor;
- private GremlinExecutor(final Map<String, EngineSettings> settings, final List<List<String>> use,
- final long scriptEvaluationTimeout, final Bindings globalBindings,
- final ExecutorService executorService, final ScheduledExecutorService scheduledExecutorService,
- final Consumer<Bindings> beforeEval, final Consumer<Bindings> afterSuccess,
- final Consumer<Bindings> afterTimeout, final BiConsumer<Bindings, Throwable> afterFailure,
- final Set<String> enabledPlugins, final boolean suppliedExecutor, final boolean suppliedScheduledExecutor,
- final Predicate<Map.Entry<String,Object>> promoteBinding) {
- this.executorService = executorService;
- this.scheduledExecutorService = scheduledExecutorService;
- this.beforeEval = beforeEval;
- this.afterSuccess = afterSuccess;
- this.afterTimeout = afterTimeout;
- this.afterFailure = afterFailure;
- this.use = use;
- this.settings = settings;
- this.scriptEvaluationTimeout = scriptEvaluationTimeout;
- this.globalBindings = globalBindings;
- this.promoteBinding = promoteBinding;
- this.enabledPlugins = enabledPlugins;
+ private GremlinExecutor(final Builder builder, final boolean suppliedExecutor,
+ final boolean suppliedScheduledExecutor) {
+
+ this.executorService = builder.executorService;
+ this.scheduledExecutorService = builder.scheduledExecutorService;
+ this.beforeEval = builder.beforeEval;
+ this.afterSuccess = builder.afterSuccess;
+ this.afterTimeout = builder.afterTimeout;
+ this.afterFailure = builder.afterFailure;
+ this.use = builder.use;
+ this.settings = builder.settings;
+ this.scriptEvaluationTimeout = builder.scriptEvaluationTimeout;
+ this.globalBindings = builder.globalBindings;
+ this.promoteBinding = builder.promoteBinding;
+ this.enabledPlugins = builder.enabledPlugins;
this.scriptEngines = createScriptEngines();
this.suppliedExecutor = suppliedExecutor;
this.suppliedScheduledExecutor = suppliedScheduledExecutor;
@@ -619,6 +615,7 @@ public class GremlinExecutor implements AutoCloseable {
suppliedExecutor.set(false);
return Executors.newScheduledThreadPool(4, threadFactory);
});
+ executorService = es;
final ScheduledExecutorService ses = Optional.ofNullable(scheduledExecutorService).orElseGet(() -> {
// if the pool is created by the builder and we need another just re-use it, otherwise create
@@ -627,10 +624,9 @@ public class GremlinExecutor implements AutoCloseable {
return (poolCreatedByBuilder.get()) ?
(ScheduledExecutorService) es : Executors.newScheduledThreadPool(4, threadFactory);
});
+ scheduledExecutorService = ses;
- return new GremlinExecutor(settings, use, scriptEvaluationTimeout, globalBindings, es,
- ses, beforeEval, afterSuccess, afterTimeout, afterFailure, enabledPlugins,
- suppliedExecutor.get(), suppliedScheduledExecutor.get(), promoteBinding);
+ return new GremlinExecutor(this, suppliedExecutor.get(), suppliedScheduledExecutor.get());
}
}