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/12/13 20:19:13 UTC

[tinkerpop] branch tp33 updated: Add isContextNullOrStopped() method to Spark

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch tp33
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/tp33 by this push:
     new e507996  Add isContextNullOrStopped() method to Spark
e507996 is described below

commit e507996c1f9f3f93813f840e5e845aad097b3e4d
Author: Alex Liu <al...@yahoo.com>
AuthorDate: Tue Dec 11 15:22:46 2018 -0500

    Add isContextNullOrStopped() method to Spark
---
 .../java/org/apache/tinkerpop/gremlin/spark/structure/Spark.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/structure/Spark.java b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/structure/Spark.java
index e4e90b3..ee61ea4 100644
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/structure/Spark.java
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/structure/Spark.java
@@ -47,7 +47,7 @@ public class Spark {
     }
 
     public static SparkContext create(final SparkConf sparkConf) {
-        if (null == CONTEXT || CONTEXT.isStopped()) {
+        if (isContextNullOrStopped()) {
             sparkConf.setAppName("Apache TinkerPop's Spark-Gremlin");
             CONTEXT = SparkContext.getOrCreate(sparkConf);
         }
@@ -146,4 +146,8 @@ public class Spark {
         CONTEXT = null;
     }
 
+    public static boolean isContextNullOrStopped() {
+        return null == CONTEXT || CONTEXT.isStopped();
+    }
+
 }