super(querySupport, threads);
}
- Objects getOrCreateObjects(QueryProcessor processor, int r1, int r2) throws DatabaseException {
+ Objects getOrCreateObjects(ReadGraphImpl graph, int r1, int r2) throws DatabaseException {
Objects existing = null;
synchronized(objectsMap) {
existing = (Objects)objectsMap.get(r1,r2);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
Objects.computeForEach(graph, r1,r2, null, procedure);
return;
}
- Objects entry = (Objects)cache.getOrCreateObjects(graph.processor, r1,r2);
+ Objects entry = (Objects)cache.getOrCreateObjects(graph, r1,r2);
IntProcedure procedure_ = procedure != null ? procedure : emptyProcedureObjects;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- Objects.computeForEach(graph, r1,r2, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ Objects.computeForEach(graph, r1,r2, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- Statements getOrCreateStatements(QueryProcessor processor, int r1, int r2) throws DatabaseException {
+ Statements getOrCreateStatements(ReadGraphImpl graph, int r1, int r2) throws DatabaseException {
Statements existing = null;
synchronized(statementsMap) {
existing = (Statements)statementsMap.get(r1,r2);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
Statements.computeForEach(graph, r1,r2, null, procedure);
return;
}
- Statements entry = (Statements)cache.getOrCreateStatements(graph.processor, r1,r2);
+ Statements entry = (Statements)cache.getOrCreateStatements(graph, r1,r2);
TripleIntProcedure procedure_ = procedure != null ? procedure : emptyProcedureStatements;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- Statements.computeForEach(graph, r1,r2, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ Statements.computeForEach(graph, r1,r2, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- DirectObjects getOrCreateDirectObjects(QueryProcessor processor, int r1, int r2) throws DatabaseException {
+ DirectObjects getOrCreateDirectObjects(ReadGraphImpl graph, int r1, int r2) throws DatabaseException {
DirectObjects existing = null;
synchronized(directObjectsMap) {
existing = (DirectObjects)directObjectsMap.get(r1,r2);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
DirectObjects.computeForEach(graph, r1,r2, null, procedure);
return;
}
- DirectObjects entry = (DirectObjects)cache.getOrCreateDirectObjects(graph.processor, r1,r2);
+ DirectObjects entry = (DirectObjects)cache.getOrCreateDirectObjects(graph, r1,r2);
IntProcedure procedure_ = procedure != null ? procedure : emptyProcedureDirectObjects;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- DirectObjects.computeForEach(graph, r1,r2, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ DirectObjects.computeForEach(graph, r1,r2, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- RelationInfoQuery getOrCreateRelationInfoQuery(QueryProcessor processor, int r) throws DatabaseException {
+ RelationInfoQuery getOrCreateRelationInfoQuery(ReadGraphImpl graph, int r) throws DatabaseException {
RelationInfoQuery existing = null;
synchronized(relationInfoQueryMap) {
existing = (RelationInfoQuery)relationInfoQueryMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
RelationInfoQuery.computeForEach(graph, r, null, procedure);
return;
}
- RelationInfoQuery entry = (RelationInfoQuery)cache.getOrCreateRelationInfoQuery(graph.processor, r);
+ RelationInfoQuery entry = (RelationInfoQuery)cache.getOrCreateRelationInfoQuery(graph, r);
InternalProcedure<RelationInfo> procedure_ = procedure != null ? procedure : emptyProcedureRelationInfoQuery;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- RelationInfoQuery.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ RelationInfoQuery.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- URIToResource getOrCreateURIToResource(QueryProcessor processor, String id) throws DatabaseException {
+ URIToResource getOrCreateURIToResource(ReadGraphImpl graph, String id) throws DatabaseException {
URIToResource existing = null;
synchronized(uRIToResourceMap) {
existing = (URIToResource)uRIToResourceMap.get(id);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
URIToResource.computeForEach(graph, id, null, procedure);
return;
}
- URIToResource entry = (URIToResource)cache.getOrCreateURIToResource(graph.processor, id);
+ URIToResource entry = (URIToResource)cache.getOrCreateURIToResource(graph, id);
InternalProcedure<Integer> procedure_ = procedure != null ? procedure : emptyProcedureURIToResource;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- URIToResource.computeForEach(graph, id, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ URIToResource.computeForEach(graph, id, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- ValueQuery getOrCreateValueQuery(QueryProcessor processor, int r) throws DatabaseException {
+ ValueQuery getOrCreateValueQuery(ReadGraphImpl graph, int r) throws DatabaseException {
ValueQuery existing = null;
synchronized(valueQueryMap) {
existing = (ValueQuery)valueQueryMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
ValueQuery.computeForEach(graph, r, null, procedure);
return;
}
- ValueQuery entry = (ValueQuery)cache.getOrCreateValueQuery(graph.processor, r);
+ ValueQuery entry = (ValueQuery)cache.getOrCreateValueQuery(graph, r);
InternalProcedure<byte[]> procedure_ = procedure != null ? procedure : emptyProcedureValueQuery;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- ValueQuery.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ ValueQuery.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- OrderedSet getOrCreateOrderedSet(QueryProcessor processor, int r) throws DatabaseException {
+ OrderedSet getOrCreateOrderedSet(ReadGraphImpl graph, int r) throws DatabaseException {
OrderedSet existing = null;
synchronized(orderedSetMap) {
existing = (OrderedSet)orderedSetMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
OrderedSet.computeForEach(graph, r, null, procedure);
return;
}
- OrderedSet entry = (OrderedSet)cache.getOrCreateOrderedSet(graph.processor, r);
+ OrderedSet entry = (OrderedSet)cache.getOrCreateOrderedSet(graph, r);
IntProcedure procedure_ = procedure != null ? procedure : emptyProcedureOrderedSet;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- OrderedSet.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ OrderedSet.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- PrincipalTypes getOrCreatePrincipalTypes(QueryProcessor processor, int r) throws DatabaseException {
+ PrincipalTypes getOrCreatePrincipalTypes(ReadGraphImpl graph, int r) throws DatabaseException {
PrincipalTypes existing = null;
synchronized(principalTypesMap) {
existing = (PrincipalTypes)principalTypesMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
PrincipalTypes.computeForEach(graph, r, null, procedure);
return;
}
- PrincipalTypes entry = (PrincipalTypes)cache.getOrCreatePrincipalTypes(graph.processor, r);
+ PrincipalTypes entry = (PrincipalTypes)cache.getOrCreatePrincipalTypes(graph, r);
IntProcedure procedure_ = procedure != null ? procedure : emptyProcedurePrincipalTypes;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- PrincipalTypes.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ PrincipalTypes.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- DirectPredicates getOrCreateDirectPredicates(QueryProcessor processor, int r) throws DatabaseException {
+ DirectPredicates getOrCreateDirectPredicates(ReadGraphImpl graph, int r) throws DatabaseException {
DirectPredicates existing = null;
synchronized(directPredicatesMap) {
existing = (DirectPredicates)directPredicatesMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
DirectPredicates.computeForEach(graph, r, null, procedure);
return;
}
- DirectPredicates entry = (DirectPredicates)cache.getOrCreateDirectPredicates(graph.processor, r);
+ DirectPredicates entry = (DirectPredicates)cache.getOrCreateDirectPredicates(graph, r);
InternalProcedure<IntSet> procedure_ = procedure != null ? procedure : emptyProcedureDirectPredicates;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- DirectPredicates.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ DirectPredicates.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- Predicates getOrCreatePredicates(QueryProcessor processor, int r) throws DatabaseException {
+ Predicates getOrCreatePredicates(ReadGraphImpl graph, int r) throws DatabaseException {
Predicates existing = null;
synchronized(predicatesMap) {
existing = (Predicates)predicatesMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
Predicates.computeForEach(graph, r, null, procedure);
return;
}
- Predicates entry = (Predicates)cache.getOrCreatePredicates(graph.processor, r);
+ Predicates entry = (Predicates)cache.getOrCreatePredicates(graph, r);
InternalProcedure<IntSet> procedure_ = procedure != null ? procedure : emptyProcedurePredicates;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- Predicates.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ Predicates.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- ReadEntry getOrCreateReadEntry(QueryProcessor processor, Read<?> r, boolean isSync) throws DatabaseException {
+ ReadEntry getOrCreateReadEntry(ReadGraphImpl graph, Read<?> r, boolean needsToBlock) throws DatabaseException {
ReadEntry existing = null;
synchronized(readEntryMap) {
existing = (ReadEntry)readEntryMap.get(r);
}
}
if(existing.isPending()) {
- if(isSync) waitPending(processor, existing);
- else return null;
+ if(needsToBlock) waitPending(graph, existing);
+ else return null;
}
return existing;
}
}
}
- public static void runnerReadEntry(ReadGraphImpl graph, Read<?> r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure, boolean isSync) throws DatabaseException {
+ public static Object runnerReadEntry(ReadGraphImpl graph, Read<?> r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure, final boolean needsToBlock) throws DatabaseException {
QueryCache cache = graph.processor.cache;
if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) {
- ReadEntry.computeForEach(graph, r, null, procedure);
- return;
+ return ReadEntry.computeForEach(graph, r, null, procedure);
}
- ReadEntry entry = (ReadEntry)cache.getOrCreateReadEntry(graph.processor, r, isSync);
+ ReadEntry entry = (ReadEntry)cache.getOrCreateReadEntry(graph, r, needsToBlock);
if(entry == null) {
- graph.processor.schedule(new SessionTask(false) {
+ graph.processor.schedule(new SessionTask(graph) {
@Override
public void run(int thread) {
try {
- assert(!isSync);
- runnerReadEntry(graph, r, parent, listener, procedure, isSync);
+ runnerReadEntry(graph, r, parent, listener, procedure, needsToBlock);
} catch (DatabaseException e) {
Logger.defaultLogError(e);
}
}
});
- return;
+ return null;
}
AsyncProcedure procedure_ = procedure != null ? procedure : emptyProcedureReadEntry;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
- if(entry.isReady()) entry.performFromCache(graph, procedure_);
+ if(entry.isReady()) return entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- ReadEntry.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ Object result = ReadEntry.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ return result;
}
}
- AsyncReadEntry getOrCreateAsyncReadEntry(QueryProcessor processor, AsyncRead<?> r, boolean isSync) throws DatabaseException {
+ AsyncReadEntry getOrCreateAsyncReadEntry(ReadGraphImpl graph, AsyncRead<?> r, boolean needsToBlock) throws DatabaseException {
AsyncReadEntry existing = null;
synchronized(asyncReadEntryMap) {
existing = (AsyncReadEntry)asyncReadEntryMap.get(r);
}
}
if(existing.isPending()) {
- if(isSync) waitPending(processor, existing);
- else return null;
+ if(needsToBlock) waitPending(graph, existing);
+ else return null;
}
return existing;
}
}
}
- public static void runnerAsyncReadEntry(ReadGraphImpl graph, AsyncRead<?> r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure, boolean isSync) throws DatabaseException {
+ public static Object runnerAsyncReadEntry(ReadGraphImpl graph, AsyncRead<?> r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure, final boolean needsToBlock) throws DatabaseException {
QueryCache cache = graph.processor.cache;
if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) {
- AsyncReadEntry.computeForEach(graph, r, null, procedure);
- return;
+ return AsyncReadEntry.computeForEach(graph, r, null, procedure, needsToBlock);
}
- AsyncReadEntry entry = (AsyncReadEntry)cache.getOrCreateAsyncReadEntry(graph.processor, r, isSync);
+ AsyncReadEntry entry = (AsyncReadEntry)cache.getOrCreateAsyncReadEntry(graph, r, needsToBlock);
if(entry == null) {
- graph.processor.schedule(new SessionTask(false) {
+ graph.processor.schedule(new SessionTask(graph) {
@Override
public void run(int thread) {
try {
- assert(!isSync);
- runnerAsyncReadEntry(graph, r, parent, listener, procedure, isSync);
+ runnerAsyncReadEntry(graph, r, parent, listener, procedure, needsToBlock);
} catch (DatabaseException e) {
Logger.defaultLogError(e);
}
}
});
- return;
+ return null;
}
AsyncProcedure procedure_ = procedure != null ? procedure : emptyProcedureAsyncReadEntry;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
- if(entry.isReady()) entry.performFromCache(graph, procedure_);
+ if(entry.isReady()) return entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- AsyncReadEntry.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ Object result = AsyncReadEntry.computeForEach(graph, r, entry, procedure_, needsToBlock);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ return result;
}
}
- Types getOrCreateTypes(QueryProcessor processor, int r) throws DatabaseException {
+ Types getOrCreateTypes(ReadGraphImpl graph, int r) throws DatabaseException {
Types existing = null;
synchronized(typesMap) {
existing = (Types)typesMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
Types.computeForEach(graph, r, null, procedure);
return;
}
- Types entry = (Types)cache.getOrCreateTypes(graph.processor, r);
+ Types entry = (Types)cache.getOrCreateTypes(graph, r);
InternalProcedure<IntSet> procedure_ = procedure != null ? procedure : emptyProcedureTypes;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- Types.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ Types.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- ChildMap getOrCreateChildMap(QueryProcessor processor, int r) throws DatabaseException {
+ ChildMap getOrCreateChildMap(ReadGraphImpl graph, int r) throws DatabaseException {
ChildMap existing = null;
synchronized(childMapMap) {
existing = (ChildMap)childMapMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
ChildMap.computeForEach(graph, r, null, procedure);
return;
}
- ChildMap entry = (ChildMap)cache.getOrCreateChildMap(graph.processor, r);
+ ChildMap entry = (ChildMap)cache.getOrCreateChildMap(graph, r);
InternalProcedure<ObjectResourceIdMap<String>> procedure_ = procedure != null ? procedure : emptyProcedureChildMap;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- ChildMap.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ ChildMap.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- TypeHierarchy getOrCreateTypeHierarchy(QueryProcessor processor, int r) throws DatabaseException {
+ TypeHierarchy getOrCreateTypeHierarchy(ReadGraphImpl graph, int r) throws DatabaseException {
TypeHierarchy existing = null;
synchronized(typeHierarchyMap) {
existing = (TypeHierarchy)typeHierarchyMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
TypeHierarchy.computeForEach(graph, r, null, procedure);
return;
}
- TypeHierarchy entry = (TypeHierarchy)cache.getOrCreateTypeHierarchy(graph.processor, r);
+ TypeHierarchy entry = (TypeHierarchy)cache.getOrCreateTypeHierarchy(graph, r);
InternalProcedure<IntSet> procedure_ = procedure != null ? procedure : emptyProcedureTypeHierarchy;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- TypeHierarchy.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ TypeHierarchy.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- SuperTypes getOrCreateSuperTypes(QueryProcessor processor, int r) throws DatabaseException {
+ SuperTypes getOrCreateSuperTypes(ReadGraphImpl graph, int r) throws DatabaseException {
SuperTypes existing = null;
synchronized(superTypesMap) {
existing = (SuperTypes)superTypesMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
SuperTypes.computeForEach(graph, r, null, procedure);
return;
}
- SuperTypes entry = (SuperTypes)cache.getOrCreateSuperTypes(graph.processor, r);
+ SuperTypes entry = (SuperTypes)cache.getOrCreateSuperTypes(graph, r);
InternalProcedure<IntSet> procedure_ = procedure != null ? procedure : emptyProcedureSuperTypes;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- SuperTypes.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ SuperTypes.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- SuperRelations getOrCreateSuperRelations(QueryProcessor processor, int r) throws DatabaseException {
+ SuperRelations getOrCreateSuperRelations(ReadGraphImpl graph, int r) throws DatabaseException {
SuperRelations existing = null;
synchronized(superRelationsMap) {
existing = (SuperRelations)superRelationsMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
SuperRelations.computeForEach(graph, r, null, procedure);
return;
}
- SuperRelations entry = (SuperRelations)cache.getOrCreateSuperRelations(graph.processor, r);
+ SuperRelations entry = (SuperRelations)cache.getOrCreateSuperRelations(graph, r);
InternalProcedure<IntSet> procedure_ = procedure != null ? procedure : emptyProcedureSuperRelations;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- SuperRelations.computeForEach(graph, r, entry, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ SuperRelations.computeForEach(graph, r, entry, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- AssertedPredicates getOrCreateAssertedPredicates(QueryProcessor processor, int r) throws DatabaseException {
+ AssertedPredicates getOrCreateAssertedPredicates(ReadGraphImpl graph, int r) throws DatabaseException {
AssertedPredicates existing = null;
synchronized(assertedPredicatesMap) {
existing = (AssertedPredicates)assertedPredicatesMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
public static void runnerAssertedPredicates(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) throws DatabaseException {
QueryCache cache = graph.processor.cache;
- AssertedPredicates entry = (AssertedPredicates)cache.getOrCreateAssertedPredicates(graph.processor, r);
+ AssertedPredicates entry = (AssertedPredicates)cache.getOrCreateAssertedPredicates(graph, r);
IntProcedure procedure_ = procedure != null ? procedure : emptyProcedureAssertedPredicates;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- entry.compute(graph, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ entry.compute(graph, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- AssertedStatements getOrCreateAssertedStatements(QueryProcessor processor, int r1, int r2) throws DatabaseException {
+ AssertedStatements getOrCreateAssertedStatements(ReadGraphImpl graph, int r1, int r2) throws DatabaseException {
AssertedStatements existing = null;
synchronized(assertedStatementsMap) {
existing = (AssertedStatements)assertedStatementsMap.get(r1,r2);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
public static void runnerAssertedStatements(ReadGraphImpl graph, int r1, int r2, CacheEntry parent, ListenerBase listener, final TripleIntProcedure procedure) throws DatabaseException {
QueryCache cache = graph.processor.cache;
- AssertedStatements entry = (AssertedStatements)cache.getOrCreateAssertedStatements(graph.processor, r1,r2);
+ AssertedStatements entry = (AssertedStatements)cache.getOrCreateAssertedStatements(graph, r1,r2);
TripleIntProcedure procedure_ = procedure != null ? procedure : emptyProcedureAssertedStatements;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- entry.compute(graph, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ entry.compute(graph, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- DirectSuperRelations getOrCreateDirectSuperRelations(QueryProcessor processor, int r) throws DatabaseException {
+ DirectSuperRelations getOrCreateDirectSuperRelations(ReadGraphImpl graph, int r) throws DatabaseException {
DirectSuperRelations existing = null;
synchronized(directSuperRelationsMap) {
existing = (DirectSuperRelations)directSuperRelationsMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
public static void runnerDirectSuperRelations(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) throws DatabaseException {
QueryCache cache = graph.processor.cache;
- DirectSuperRelations entry = (DirectSuperRelations)cache.getOrCreateDirectSuperRelations(graph.processor, r);
+ DirectSuperRelations entry = (DirectSuperRelations)cache.getOrCreateDirectSuperRelations(graph, r);
IntProcedure procedure_ = procedure != null ? procedure : emptyProcedureDirectSuperRelations;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- entry.compute(graph, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ entry.compute(graph, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- MultiReadEntry getOrCreateMultiReadEntry(QueryProcessor processor, MultiRead<?> r) throws DatabaseException {
+ MultiReadEntry getOrCreateMultiReadEntry(ReadGraphImpl graph, MultiRead<?> r) throws DatabaseException {
MultiReadEntry existing = null;
synchronized(multiReadEntryMap) {
existing = (MultiReadEntry)multiReadEntryMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
public static void runnerMultiReadEntry(ReadGraphImpl graph, MultiRead<?> r, CacheEntry parent, ListenerBase listener, final SyncMultiProcedure procedure) throws DatabaseException {
QueryCache cache = graph.processor.cache;
- MultiReadEntry entry = (MultiReadEntry)cache.getOrCreateMultiReadEntry(graph.processor, r);
+ MultiReadEntry entry = (MultiReadEntry)cache.getOrCreateMultiReadEntry(graph, r);
SyncMultiProcedure procedure_ = procedure != null ? procedure : emptyProcedureMultiReadEntry;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- entry.compute(graph, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ entry.compute(graph, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- AsyncMultiReadEntry getOrCreateAsyncMultiReadEntry(QueryProcessor processor, AsyncMultiRead<?> r) throws DatabaseException {
+ AsyncMultiReadEntry getOrCreateAsyncMultiReadEntry(ReadGraphImpl graph, AsyncMultiRead<?> r) throws DatabaseException {
AsyncMultiReadEntry existing = null;
synchronized(asyncMultiReadEntryMap) {
existing = (AsyncMultiReadEntry)asyncMultiReadEntryMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
public static void runnerAsyncMultiReadEntry(ReadGraphImpl graph, AsyncMultiRead<?> r, CacheEntry parent, ListenerBase listener, final AsyncMultiProcedure procedure) throws DatabaseException {
QueryCache cache = graph.processor.cache;
- AsyncMultiReadEntry entry = (AsyncMultiReadEntry)cache.getOrCreateAsyncMultiReadEntry(graph.processor, r);
+ AsyncMultiReadEntry entry = (AsyncMultiReadEntry)cache.getOrCreateAsyncMultiReadEntry(graph, r);
AsyncMultiProcedure procedure_ = procedure != null ? procedure : emptyProcedureAsyncMultiReadEntry;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- entry.compute(graph, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ entry.compute(graph, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}
- ExternalReadEntry getOrCreateExternalReadEntry(QueryProcessor processor, ExternalRead<?> r) throws DatabaseException {
+ ExternalReadEntry getOrCreateExternalReadEntry(ReadGraphImpl graph, ExternalRead<?> r) throws DatabaseException {
ExternalReadEntry existing = null;
synchronized(externalReadEntryMap) {
existing = (ExternalReadEntry)externalReadEntryMap.get(r);
return existing;
}
}
- if(existing.isPending()) waitPending(processor, existing);
+ if(existing.isPending()) waitPending(graph, existing);
return existing;
}
public static void runnerExternalReadEntry(ReadGraphImpl graph, ExternalRead<?> r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure) throws DatabaseException {
QueryCache cache = graph.processor.cache;
- ExternalReadEntry entry = (ExternalReadEntry)cache.getOrCreateExternalReadEntry(graph.processor, r);
+ ExternalReadEntry entry = (ExternalReadEntry)cache.getOrCreateExternalReadEntry(graph, r);
AsyncProcedure procedure_ = procedure != null ? procedure : emptyProcedureExternalReadEntry;
ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);
if(entry.isReady()) entry.performFromCache(graph, procedure_);
else {
assert(entry.isPending());
- entry.compute(graph, procedure_);
- if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
+ entry.compute(graph, procedure_);
+ if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());
}
}