[ 
https://issues.apache.org/jira/browse/TINKERPOP-1490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15629262#comment-15629262
 ] 

ASF GitHub Bot commented on TINKERPOP-1490:
-------------------------------------------

GitHub user spmallette opened a pull request:

    https://github.com/apache/tinkerpop/pull/478

    TINKERPOP-1490 Implemented promise API for Traversal

    https://issues.apache.org/jira/browse/TINKERPOP-1490
    
    Added two promise() methods that return `CompletableFuture` on `Traversal`. 
Provided an override on `DefaultTraversal` for those methods because the 
function that transforms the Traversal is executed in a different thread and 
therefore requires Graph transaction management (or else we would orphan 
transactions). Did not update gremlin-python with the promise API because it 
seemed to beg discussion on the "right" way to do that (i.e. what library to 
use to support promises?, just use futures from the core lib?, etc).
    
    Had to move `commons-lang` to `gremlin-core` as a dependency (it was in 
`gremlin-groovy`) so I that I could make use of the thread naming factory. 
Doesn't really change anything as `gremlin-groovy` packaged with the console 
and server anyway. LICENSE/NOTICE can remain unchanged as a result.
    
    Works with `mvn clean install -DincludeNeo4j`.
    
    VOTE +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1490

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/478.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #478
    
----
commit 9ad3042ff876a88af719a95b8e144f56b10c81c4
Author: Stephen Mallette <sp...@genoprime.com>
Date:   2016-11-01T13:30:28Z

    TINKERPOP-1490 Implemented promise API for Traversal
    
    Added two promise() methods that return CompletableFuture on Traversal. 
Provided an override on DefaultTraversal for those methods because the function 
that transforms the Traversal is executed in a different thread and therefore 
requires Graph transaction management (or else we would orphan transactions). 
Did not update gremlin-python with the promise API because it seemed to beg 
discussion on the "right" way to do that (i.e. what library to use to support 
promises?, just use futures from the core lib?, etc).

----


> Provider a Future based Traversal.async(Function<Traversal,V>) terminal step
> ----------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1490
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1490
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: language-variant, process
>    Affects Versions: 3.2.2
>            Reporter: Marko A. Rodriguez
>
> [~mbroecheler] had the idea of adding a {{Traversal.async()}} method. This is 
> important for not only avoiding thread locking on a query in Gremlin, but 
> also, it will allow single threaded language variants like Gremlin-JavaScript 
> to use callbacks for processing query results.
> {code}
> Future<List<String>> result = 
> g.V().out().values("name").async(Traversal::toList)
> {code}
> {code}
> Future<List<String>> result = g.V().out().name.async{it.toList()}
> {code}
> {code}
> g.V().out().values('name').async((err,names) => {
>   // I don't know JavaScript, but ...
>   return list(names);
> }) 
> {code}
> ...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to