Class EmbeddedRemoteConnection
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.remote.EmbeddedRemoteConnection
-
- All Implemented Interfaces:
AutoCloseable,RemoteConnection
public class EmbeddedRemoteConnection extends Object implements RemoteConnection
Allows aRemoteConnectionto be submitted to a "local"Graphinstance thus simulating a connection to a remote source. Basic usage is as follows:// Using TinkerGraph here but any embedded Graph instance would suffice Graph graph = TinkerFactory.createModern(); GraphTraversalSource g = graph.traversal(); // setup the remote as normal but give it the embedded "g" so that it executes against that GraphTraversalSource simulatedRemoteG = TraversalSourceFactory.traversal(new EmbeddedRemoteConnection(g)); assertEquals(6, simulatedRemoteG.V().count().next().intValue());- Author:
- Stephen Mallette (http://stephen.genoprime.com)
-
-
Field Summary
-
Fields inherited from interface org.apache.tinkerpop.gremlin.process.remote.RemoteConnection
GREMLIN_REMOTE, GREMLIN_REMOTE_CONNECTION_CLASS
-
-
Constructor Summary
Constructors Constructor Description EmbeddedRemoteConnection(GraphTraversalSource g)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()<E> CompletableFuture<RemoteTraversal<?,E>>submitAsync(Bytecode bytecode)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.remote.RemoteConnection
tx
-
-
-
-
Constructor Detail
-
EmbeddedRemoteConnection
public EmbeddedRemoteConnection(GraphTraversalSource g)
-
-
Method Detail
-
submitAsync
public <E> CompletableFuture<RemoteTraversal<?,E>> submitAsync(Bytecode bytecode) throws RemoteConnectionException
Description copied from interface:RemoteConnectionSubmitsTraversalBytecodeto a server and returns a promise of aRemoteTraversal. TheRemoteTraversalis an abstraction over two types of results that can be returned as part of the response from the server: the results of theTraversalitself and the side-effects that it produced.- Specified by:
submitAsyncin interfaceRemoteConnection- Throws:
RemoteConnectionException
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
-