Search in sources :

Example 1 with DelegatingFramedGraph

use of com.syncleus.ferma.DelegatingFramedGraph in project open-kilda by telstra.

the class OrientDbGraphFactory method getGraph.

/**
 * Returns an instance of framed graph which is bound to the current persistence context.
 * Create a new one if there's no such.
 */
@Override
public DelegatingFramedGraph<OrientGraph> getGraph() {
    Connect effectiveConnect = getConnectCreateIfMissing();
    OrientGraphFactory factory = effectiveConnect.getFactory();
    log.debug("Opening a framed graph for {}", factory);
    OrientGraph orientGraph = Failsafe.with(newPoolAcquireRetryPolicy()).get(() -> {
        OrientGraph obtainedGraph = factory.getTx();
        validateGraph(obtainedGraph);
        return obtainedGraph;
    });
    log.debug("OrientGraph instance has been created: {}", orientGraph);
    return new DelegatingFramedGraph<>(orientGraph, effectiveConnect.getBuilder(), effectiveConnect.getTypeResolver());
}
Also used : DelegatingFramedGraph(com.syncleus.ferma.DelegatingFramedGraph) OrientGraph(org.apache.tinkerpop.gremlin.orientdb.OrientGraph) OrientGraphFactory(org.apache.tinkerpop.gremlin.orientdb.OrientGraphFactory)

Aggregations

DelegatingFramedGraph (com.syncleus.ferma.DelegatingFramedGraph)1 OrientGraph (org.apache.tinkerpop.gremlin.orientdb.OrientGraph)1 OrientGraphFactory (org.apache.tinkerpop.gremlin.orientdb.OrientGraphFactory)1