CTR: ExecutorServices in TinkerGraphComputer and SparkGraphComputer can only be 
used, but
they were not shut down after being used. This prevented applications from 
shutting down
properly as there were still threads lingering. I'm not sure about 
GiraphGraphComputer as
it uses a slightly different model.


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

Branch: refs/heads/TINKERPOP-1642
Commit: df285d38027d46f5dcabf4ce5831b6028624bc9f
Parents: 258dccb
Author: Daniel Kuppitz <[email protected]>
Authored: Wed Mar 8 22:20:33 2017 +0100
Committer: Daniel Kuppitz <[email protected]>
Committed: Wed Mar 8 22:20:33 2017 +0100

----------------------------------------------------------------------
 .../gremlin/spark/process/computer/SparkGraphComputer.java       | 4 +++-
 .../tinkergraph/process/computer/TinkerGraphComputer.java        | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/df285d38/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkGraphComputer.java
----------------------------------------------------------------------
diff --git 
a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkGraphComputer.java
 
b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkGraphComputer.java
index 6d2742b..00a2e46 100644
--- 
a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkGraphComputer.java
+++ 
b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkGraphComputer.java
@@ -131,7 +131,7 @@ public final class SparkGraphComputer extends 
AbstractHadoopGraphComputer {
 
     private Future<ComputerResult> submitWithExecutor(Executor exec) {
         // create the completable future
-        return computerService.submit(() -> {
+        final Future<ComputerResult> result = computerService.submit(() -> {
             final long startTime = System.currentTimeMillis();
             // apache and hadoop configurations that are used throughout the 
graph computer computation
             final org.apache.commons.configuration.Configuration 
graphComputerConfiguration = new HadoopConfiguration(this.sparkConfiguration);
@@ -378,6 +378,8 @@ public final class SparkGraphComputer extends 
AbstractHadoopGraphComputer {
                     Spark.close();
             }
         });
+        computerService.shutdown();
+        return result;
     }
 
     /////////////////

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/df285d38/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
----------------------------------------------------------------------
diff --git 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
index 2abce9a..bf6f594 100644
--- 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
+++ 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
@@ -154,7 +154,7 @@ public final class TinkerGraphComputer implements 
GraphComputer {
 
         // initialize the memory
         this.memory = new TinkerMemory(this.vertexProgram, this.mapReducers);
-        return computerService.submit(() -> {
+        final Future<ComputerResult> result = computerService.submit(() -> {
             final long time = System.currentTimeMillis();
             final TinkerGraphComputerView view = 
TinkerHelper.createGraphComputerView(this.graph, this.graphFilter, null != 
this.vertexProgram ? this.vertexProgram.getVertexComputeKeys() : 
Collections.emptySet());
             final TinkerWorkerPool workers = new TinkerWorkerPool(this.graph, 
this.memory, this.workers);
@@ -246,6 +246,8 @@ public final class TinkerGraphComputer implements 
GraphComputer {
                 workers.close();
             }
         });
+        this.computerService.shutdown();
+        return result;
     }
 
     @Override

Reply via email to