public class EmbeddedRemoteConnection extends Object implements RemoteConnection
RemoteConnection
to be submitted to a "local" Graph
instance 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
final Graph remote = EmptyGraph.instance();
GraphTraversalSource simulatedRemoteG = remote.traversal().withRemote(new EmbeddedRemoteConnection(g));
assertEquals(6, simulatedRemoteG.V().count().next().intValue());
Constructor and Description |
---|
EmbeddedRemoteConnection(GraphTraversalSource g) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
<E> RemoteTraversal<?,E> |
submit(Bytecode bytecode)
|
<E> Iterator<Traverser.Admin<E>> |
submit(Traversal<?,E> traversal) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
submitAsync
public EmbeddedRemoteConnection(GraphTraversalSource g)
public <E> Iterator<Traverser.Admin<E>> submit(Traversal<?,E> traversal) throws RemoteConnectionException
submit
in interface RemoteConnection
RemoteConnectionException
public <E> RemoteTraversal<?,E> submit(Bytecode bytecode) throws RemoteConnectionException
RemoteConnection
Traversal
Bytecode
to a server and returns a RemoteTraversal
.
The RemoteTraversal
is an abstraction over two types of results that can be returned as part of the
response from the server: the results of the Traversal
itself and the side-effects that it produced.submit
in interface RemoteConnection
RemoteConnectionException
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2013–2018 Apache Software Foundation. All rights reserved.