Concurrent Graphs


#1

Hello,

How can I create multiple graphs pointing to the same name ?

I see that MindmapsClient.getGraph("name") always returns the same graph. MindmapsClient.getGraphBatchLoading("name") seems to return a different graph. Does that mean I am limited to just 2 concurrent graphs ?

Thanks.


#2

What do you mean by saying that it returns a “different graph”? Does the batch loading graph not containing the same instances as the first graph you got from getGraph("name")?

Technically they should return the same graph. If they don’t, could this be a bug? @filipe what’s your take on this?


#3

The java objects returned by getGraph and getGraphBatchLoading are different. This is because the former follows normal procedures when mutating the graph and latter switches off some safety checks in favour of faster mutations. Both graphs however point to the same persisted layer. So this is not a bug.

With regards to the original question, right now our graphs are thread bound so if effectively you wanted more than one graph so you could perform different mutations at the same time you would have to call getGraph in different threads. Or even more simply just pass the original graph into a different thread, this will automatically create a new thread bound instance for you to work with.


#4

Thank you for the reply. Essentially I am asking how can I acquire different connections to the graph.

I think I understand now in that each thread has it’s own connection and a thread can at maximum have a normal connection and a batch loading connection. If I want more than that I must open connections in different threads. Is that it ?