I have few tasks, which is a Runnable indeed, run simultaneously and they use the same DgraphClient from dgraph4j.
Is it thread-safe for DgraphClient?
Or how to use it properly in multi-threading environment?
I have few tasks, which is a Runnable indeed, run simultaneously and they use the same DgraphClient from dgraph4j.
Is it thread-safe for DgraphClient?
Or how to use it properly in multi-threading environment?
Don’t worry too much . It’s thread-safe.
you can see
final ReentrantLock lrLck = new ReentrantLock();
DgraphClient.newTransaction()
in DgraphClient.java
's source code .