final LinkedList<T> items = new LinkedList<T>();
- protected ExternalRead<T> request;
- protected ReadGraphImpl graph;
+ protected ExternalRead<T> id;
+ protected QueryProcessor processor;
protected boolean registered = false;
@Override
int makeHash() {
- return request.hashCode();
+ return id.hashCode();
}
@Override
public Object getOriginalRequest() {
- return request;
+ return id;
}
@Override
@Override
public void discard() {
- request.unregistered();
- request = null;
- graph = null;
+ id.unregistered();
+ id = null;
+ processor = null;
super.discard();
}
@Override
- public void setPending() {
+ public void setPending(QuerySupport querySupport) {
//if(result != NO_RESULT) {
//new Exception("result = " + result).printStackTrace();
//}
public ExternalReadEntry(ExternalRead<T> request, ReadGraphImpl graph) {
assert request != null;
- this.request = request;
- this.graph = graph;
+ this.id = request;
+ this.processor = graph.processor;
}
@Override
}
// Reschedule
if(!items.isEmpty()) {
- graph.processor.updatePrimitive(request);
+ graph.processor.updatePrimitive(id);
}
}
@Override
public String toString() {
- if(request == null) return "DISCARDED ExternalRead";
- else return request.toString();
+ if(id == null) return "DISCARDED ExternalRead";
+ else return id.toString();
}
};
@Override
public String toString() {
- if(request == null) return "DISCARDED ExternalRead " + System.identityHashCode(this);
- else return request.toString() + " " + + System.identityHashCode(this);
+ if(id == null) return "DISCARDED ExternalRead " + System.identityHashCode(this);
+ else return id.toString() + " " + + System.identityHashCode(this);
}
@Override
try {
- ReadGraphImpl queryGraph = graph.withParent(this);
+ ReadGraphImpl queryGraph = graph.withParent(this, null, true);
+ queryGraph.asyncBarrier.inc();
- if(!registered) {
- request.register(graph, this);
+ if (!registered) {
+ id.register(queryGraph, this);
registered = true;
}
-
- queryGraph.asyncBarrier.waitBarrier(request, graph);
+
+ queryGraph.asyncBarrier.dec();
+ queryGraph.asyncBarrier.waitBarrier(id, queryGraph);
} catch (Throwable t) {
synchronized(items) {
items.addLast(result);
- graph.processor.updatePrimitive(request);
+ processor.updatePrimitive(id);
// TODO: implement flags/logic in ExternalRead to state that all but the latest request result can be evaporated
// In some cases where data is produced really fast this might be necessary but currently this queueing will do.
}
@Override
public boolean isDisposed() {
- return registered && (isDiscarded() || !graph.processor.isBound(this));
+ return registered && (isDiscarded() || !processor.isBound(this));
}
}