finished = true;
}
}
public void testMultipleSessions() throws InterruptedException, IOException {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
((SparkseeGraph) graph).typeScope.set(true);
this.stopWatch();
// This test requires a multiple sessions license,
// so just executed if a license has been given,
// see SparkseeGraphTest#generateGraph(...) -> blueprints-sparksee.cfg
com.sparsity.sparksee.gdb.SparkseeConfig cfg = new com.sparsity.sparksee.gdb.SparkseeConfig();
if (cfg.getLicense() == null || cfg.getLicense().length() == 0) {
printPerformance(graph.toString(), null, "skip because no license", this.stopWatch());
graph.shutdown();
return;
}
new GraphMLReader(graph).inputGraph(GraphMLReader.class.getResourceAsStream("graph-example-2.xml"));
printPerformance(graph.toString(), null, "load", this.stopWatch());
List<SessionThread> threads = new ArrayList<SessionThread>();
for (int i = 0; i < 10; i++)
threads.add(new SessionThread(graph));
this.stopWatch();
for (SessionThread th : threads)
th.start();
Thread.sleep(5000);
for (SessionThread th : threads)
th.stop = true;
int acum = 0;
for (SessionThread th : threads) {
while (!th.finished)
;
acum += th.counter;
}
printPerformance(graph.toString(), acum, "tx (sessions)", this.stopWatch());
graph.shutdown();
}