In many of the examples using the java arangoDB driver, they use method chaining
arangoDB.db("myDatabase").createCollection("myCollection", null);
or
arangoDB.db("myDatabase").collection("myCollection").insertDocument(myObject);
Are there any drawbacks with re-using objects?
ArangoDatabase db = arangoDB.db("myDatabase");
...
db.createCollection("myCollection", null);
ArangoCollection coll = db.collection("myCollection");
...
coll.insertDocument(myObject);
I am not sure if chaining approach is preferred or just for simplicity (fewer lines for an example).
- Is there much of a performance benefit to reuse? Less object creation overhead...
- Are connection, database and collection objects thread safe? i.e after getting a database can the object be shared between multiple threads?