[
https://issues.apache.org/jira/browse/TINKERPOP-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16452218#comment-16452218
]
ASF GitHub Bot commented on TINKERPOP-1950:
-------------------------------------------
Github user robertdale commented on the issue:
https://github.com/apache/tinkerpop/pull/855
Well, you would do use ConcurrentHashMap ;-)
```
static Map<Class, Boolean> LOADED = new ConcurrentHashMap<>();
try {
LOADED.computeIfAbsent(graphOrGraphComputerClass, (unused) -> {
final String graphComputerClassName = null !=
graphOrGraphComputerClass.getDeclaringClass()
?
graphOrGraphComputerClass.getCanonicalName().replace(
"." +
graphOrGraphComputerClass.getSimpleName(),
"$" +
graphOrGraphComputerClass.getSimpleName())
: graphOrGraphComputerClass.getCanonicalName();
try {
Class.forName(graphComputerClassName);
} catch (ClassNotFoundException e) {
throw new RuntimeException(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 Boolean.TRUE;
});
} catch (Exception e) {
throw new IllegalStateException(e.getCause().getMessage(),
e.getCause());
}
```
> Traversal construction performance enhancements
> -----------------------------------------------
>
> Key: TINKERPOP-1950
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1950
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.2.8
> Reporter: stephen mallette
> Assignee: stephen mallette
> Priority: Major
> Fix For: 3.4.0, 3.2.9, 3.3.3
>
>
> The process of constructing a {{Traversal}} could be made more efficient.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)