jlowenz / hypergraphdb

Automatically exported from code.google.com/p/hypergraphdb
0 stars 0 forks source link

Test compiled queries concurrent use #84

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It has been reported that when pre-compiled queries are used concurrently, 
various problems related to shared occur. HGSearchResults shouldn't be shared 
between different query executions and variable values should be thread local. 
We need a test to reproduce the problem. Apparently it happens with even simple 
queries. 

Original issue reported on code.google.com by borislav...@gmail.com on 10 Jul 2012 at 11:25

GoogleCodeExporter commented 9 years ago
Here is an example of such a query:
if (query == null) {
  query = hg.make(HGHandle.class, graph).compile(               hg.and(hg.typePlus(tpHdl), hg.incidentNotAt(hg.var("contextTarget", context), 0)));
}

final List<HGHandle> allRels;
synchronized (query) {   <---added to avoid issue
  query.var("contextTarget", context);
  allRels = hg.findAll(query); //$NON-NLS-1$
}

for (HGHandle linkHdl : allRels) {
  ...
}

Original comment by alpic80 on 10 Jul 2012 at 11:40

GoogleCodeExporter commented 9 years ago

Original comment by borislav...@gmail.com on 16 Jul 2012 at 4:36