I've a use case where I build a graph from data retrieved from multiple data stores. Each of those data stores has its own client library that builds the sub-graph representing that particular data stores data.
Current implementation Since, I didn't have any concurrency requirements, I build a single Graph object in the service layer and pass it to each of those client libraries and they will use the same Graph instance
New implementation - to meet the SLA
To meet the SLA, i want to pull the data from these data stores concurrently.
- In this scenario, can each of the client libraries build the sub-graph using the same Graph instance passed from the service layer?
- Or is there a better way to handle this?
EDIT
How the object being used
- Client sends a REST request to pull person data
- Person data is stored in 3 different data stores
- Service layer creates an instance of
com.tinkerpop.blueprints.impls.tg.TinkerGraph
and shares it among 3 different threads retreiving the data from 3 different store simultaneously on 3 different threads. Each thread also responsible for adding the data pulled to the shared Graph instance.