We've done this quite heavily where we have 2 databases and access is
spread across many threads and are constantly switching between access of
either database, nearly always with multiple concurrent threads.
Use the database pooling classes if you can, but you don't have to.
Works fine as long as you make sure the db instance is set active
appropriately before any access to the database.
ODatabaseThreadLocal.INSTANCE().set( db );
Don't try to pass database documents or database instances across threads.
get the database instance; Do your reads/writes on one thread and release
the instance back to the pool.
Failure to to set the instance correctly will result in transaction commit
failures where you created an object against one database but tried to save
against a different database. You can also get database corruptions where
indexes have references to objects that don't exist.
As long as you set the instance correctly it works.
On Tuesday, June 24, 2014 2:08:21 PM UTC-4, Jason Nichols wrote:
>
> Hi Guys,
> Are there any restrictions or limitations on using multiple embedded
> OObjectDatabaseTx within a single VM? I'm attempting to create multiple
> OODB instances like such:
>
> odb = new OObjectDatabaseTx("plocal:" + dbPath);
>
> Where the dbPath can vary. I end up with multiple OODB instances, but
> they each same to use the same local db folder, regardless of what path I
> specify in the constructor.
>
> Thanks!
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.