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 2018/03/22 19:17:04 UTC

[02/26] tinkerpop git commit: Support construct a GremlinServer instance from gremlin executor service

Support construct a GremlinServer instance from gremlin executor service

This constructor is useful when Gremlin Server is being used in an embedded
style and there is a need to share thread pools with the hosting application.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d3dbd137
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d3dbd137
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d3dbd137

Branch: refs/heads/TINKERPOP-1866
Commit: d3dbd13777f91ec1cd94fc83d309300c6181d29a
Parents: 2fd0f25
Author: Jermy Li <ja...@gmail.com>
Authored: Thu Mar 8 19:10:48 2018 +0800
Committer: Jermy Li <ja...@gmail.com>
Committed: Mon Mar 19 20:16:58 2018 +0800

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/server/GremlinServer.java | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d3dbd137/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
index 5b04ebe..55a1d84 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
@@ -81,6 +81,15 @@ public class GremlinServer {
      * Construct a Gremlin Server instance from {@link Settings}.
      */
     public GremlinServer(final Settings settings) {
+        this(settings, null);
+    }
+
+    /**
+     * Construct a Gremlin Server instance from {@link Settings} and {@link ExecutorService}.
+     * This constructor is useful when Gremlin Server is being used in an embedded style
+     * and there is a need to share thread pools with the hosting application.
+     */
+    public GremlinServer(final Settings settings, final ExecutorService gremlinExecutorService) {
         settings.optionalMetrics().ifPresent(GremlinServer::configureMetrics);
         this.settings = settings;
         provideDefaultForGremlinPoolSize(settings);
@@ -108,8 +117,8 @@ public class GremlinServer {
             workerGroup = new NioEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker);
         }
 
-        serverGremlinExecutor = new ServerGremlinExecutor(settings, null, workerGroup);
-        gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService();
+        serverGremlinExecutor = new ServerGremlinExecutor(settings, gremlinExecutorService, workerGroup);
+        this.gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService();
 
         // initialize the OpLoader with configurations being passed to each OpProcessor implementation loaded
         OpLoader.init(settings);