Search in sources :

Example 11 with InternalVertex

use of org.janusgraph.graphdb.internal.InternalVertex in project janusgraph by JanusGraph.

the class GuavaVertexCache method get.

@Override
public InternalVertex get(final long id, final Retriever<Long, InternalVertex> retriever) {
    final Long vertexId = id;
    InternalVertex vertex = cache.getIfPresent(vertexId);
    if (vertex == null) {
        InternalVertex newVertex = volatileVertices.get(vertexId);
        if (newVertex == null) {
            newVertex = retriever.get(vertexId);
        }
        assert newVertex != null;
        try {
            vertex = cache.get(vertexId, new NewVertexCallable(newVertex));
        } catch (Exception e) {
            throw new AssertionError("Should not happen: " + e.getMessage());
        }
        assert vertex != null;
    }
    return vertex;
}
Also used : NonBlockingHashMapLong(org.cliffc.high_scale_lib.NonBlockingHashMapLong) InternalVertex(org.janusgraph.graphdb.internal.InternalVertex)

Aggregations

InternalVertex (org.janusgraph.graphdb.internal.InternalVertex)11 InternalRelation (org.janusgraph.graphdb.internal.InternalRelation)7 InternalRelationType (org.janusgraph.graphdb.internal.InternalRelationType)3 NonBlockingHashMapLong (org.cliffc.high_scale_lib.NonBlockingHashMapLong)2 JanusGraphSchemaVertex (org.janusgraph.graphdb.types.vertices.JanusGraphSchemaVertex)2 LongArrayList (com.carrotsearch.hppc.LongArrayList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Iterator (java.util.Iterator)1 NoSuchElementException (java.util.NoSuchElementException)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 EdgeLabel (org.janusgraph.core.EdgeLabel)1 PropertyKey (org.janusgraph.core.PropertyKey)1 Change (org.janusgraph.core.log.Change)1 Entry (org.janusgraph.diskstorage.Entry)1 IndexEntry (org.janusgraph.diskstorage.indexing.IndexEntry)1 IndexTransaction (org.janusgraph.diskstorage.indexing.IndexTransaction)1 SliceQuery (org.janusgraph.diskstorage.keycolumnvalue.SliceQuery)1 RecordIterator (org.janusgraph.diskstorage.util.RecordIterator)1