Search code examples
orientdb

What parts of the orientdb Java API are thread safe?


Looking through the source of ORecord class, its looks like its not designed with multi-threading in mind.

Is there a guide for thread-safe use of the API?


Solution

  • If you work with database instance the common approach is to have separate instance of this object for each thread, to simplify this task you may use pool of database objects, for example com.orientechnologies.orient.core.db.OPartitionedDatabasePool. In general only OStorage instances are thread safe, the rest of objects should not be shared between threads, but should be loaded using database instance.