jboss / jboss-nosql

3 stars 0 forks source link

Add support for OrientDB #14

Closed gytis closed 7 years ago

gytis commented 7 years ago

Implement a subsystem to provide support for OrientDB.

OrientDB has three API types which should be injected: Graph API, Document API, and Object API. However, we should consider if adding Object API worth it, because it hasn't been updated since version 1.5 and is not a recommended way of using OrientDB based on their documentation http://orientdb.com/docs/last/Java-API.html#object-api.

Graph API To use Graph API OrientGraph needs to be injected. It is not thread safe and does automatic transaction management. OrientGraphFactory could also be used to create OrientGraph, so we should inject it too. This would allow users to connect to other databases from the ones defined in the config. We should proxy OrientGraph and as a result OrientGraphFactory to be able to control transactions.

More info on Graph API: http://orientdb.com/docs/last/Graph-Database-Tinkerpop.html

Document API To use Document API ODatabaseDocumentTx needs to be injected. Database instances are not thread safe and new instance should be created for every thread. It does support ACID transactions, thus we should proxy it in order to be able to control the transactions with JTA API. ODatabaseDocumentTx allows users to control security and indexes. We need to investigate if this is safe and has any impact for us.

More info on Document API: http://orientdb.com/docs/last/Document-Database.html

Object API To use Object API OObjectDatabaseTx needs to be injected. Database instances are not thread safe and new instance should be created for every thread.

More info on Object API: http://orientdb.com/docs/last/Object-Database.html

scottmarlow commented 7 years ago

I think there may be a broken "multi-thread Access" link on the Document API page. http://orientdb.com/docs/last/Java-Multi-Threading.html has info on threading. It seems that the very last thing done after opening a database, is calling database.close() to clear the ThreadLocal reference to the database. Each time that you open a database, the ThreadLocal references the opened database. When you close a database, the ThreadLocal is cleared.

gytis commented 7 years ago

https://github.com/scottmarlow/wildfly/pull/8