tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject [46/50] [abbrv] tinkerpop git commit: Reverted change from 1d9e6dc6d30c5c7d56e4007527365793eb1f223e
Date Thu, 26 Apr 2018 00:03:38 GMT
Reverted change from 1d9e6dc6d30c5c7d56e4007527365793eb1f223e

Not sure why, but the above referenced change seemed to hang various integration tests. CTR


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

Branch: refs/heads/TINKERPOP-1447
Commit: 789e5752d8f6f781272a7c56f0d2b491849d4ca9
Parents: 6096a4c
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Wed Apr 25 18:38:53 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Wed Apr 25 18:38:53 2018 -0400

----------------------------------------------------------------------
 .../process/traversal/TraversalStrategies.java  | 43 +++++++++-----------
 1 file changed, 20 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/789e5752/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index 37cd1a6..091687a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -203,7 +203,7 @@ public interface TraversalStrategies extends Serializable, Cloneable {
          * Keeps track of {@link GraphComputer} and/or {@link Graph} classes that have been
initialized to the
          * classloader so that they do not have to be reflected again.
          */
-        private static Map<Class, Boolean> LOADED = new ConcurrentHashMap<>();
+        private static Set<Class> LOADED = ConcurrentHashMap.newKeySet();
 
         private static final Map<Class<? extends Graph>, TraversalStrategies>
GRAPH_CACHE = new HashMap<>();
         private static final Map<Class<? extends GraphComputer>, TraversalStrategies>
GRAPH_COMPUTER_CACHE = new HashMap<>();
@@ -249,28 +249,27 @@ public interface TraversalStrategies extends Serializable, Cloneable
{
         }
 
         public static TraversalStrategies getStrategies(final Class graphOrGraphComputerClass)
{
-            // be sure to load the class so that its static{} traversal strategy registration
component is loaded.
-            // this is more important for GraphComputer classes as they are typically not
instantiated prior to
-            // strategy usage like Graph classes.
-            LOADED.computeIfAbsent(graphOrGraphComputerClass, unused ->  {
-                final String graphComputerClassName = null != graphOrGraphComputerClass.getDeclaringClass()
?
-                    graphOrGraphComputerClass.getCanonicalName().replace("." + graphOrGraphComputerClass.getSimpleName(),
"$" + graphOrGraphComputerClass.getSimpleName()) :
-                    graphOrGraphComputerClass.getCanonicalName();
-
-                try {
+            try {
+                // be sure to load the class so that its static{} traversal strategy registration
component is loaded.
+                // this is more important for GraphComputer classes as they are typically
not instantiated prior to
+                // strategy usage like Graph classes.
+                if (!LOADED.contains(graphOrGraphComputerClass)) {
+                    final String graphComputerClassName = null != graphOrGraphComputerClass.getDeclaringClass()
?
+                            graphOrGraphComputerClass.getCanonicalName().replace("." + graphOrGraphComputerClass.getSimpleName(),
"$" + graphOrGraphComputerClass.getSimpleName()) :
+                            graphOrGraphComputerClass.getCanonicalName();
                     Class.forName(graphComputerClassName);
-                } catch (ClassNotFoundException e) {
-                    throw new IllegalStateException(e.getMessage(), e);
+
+                    // keep track of stuff we already loaded once - stuff in this if/statement
isn't cheap and this
+                    // method gets called a lot, basically every time a new traversal gets
spun up (that includes
+                    // child traversals. perhaps it is possible to just check the cache keys
for this information, but
+                    // it's not clear if this method will be called with something not in
the cache and if it is and
+                    // it results in error, then we'd probably not want to deal with this
block again anyway
+                    LOADED.add(graphOrGraphComputerClass);
                 }
+            } catch (final ClassNotFoundException e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
 
-                // keep track of stuff we already loaded once - stuff in this if/statement
isn't cheap and this
-                // method gets called a lot, basically every time a new traversal gets spun
up (that includes
-                // child traversals. perhaps it is possible to just check the cache keys
for this information, but
-                // it's not clear if this method will be called with something not in the
cache and if it is and
-                // it results in error, then we'd probably not want to deal with this block
again anyway
-                return true;
-            });
-            
             if (GRAPH_CACHE.containsKey(graphOrGraphComputerClass)) {
                 return GRAPH_CACHE.get(graphOrGraphComputerClass);
             } else if (Graph.class.isAssignableFrom(graphOrGraphComputerClass)) {
@@ -284,6 +283,4 @@ public interface TraversalStrategies extends Serializable, Cloneable {
             }
         }
     }
-
-
-}
+}
\ No newline at end of file


Mime
View raw message