I'm not super familiar with OrientDB as I have just started developing with 
it. However, I have successfully used the OPartitionedDatabasePool. That 
should be thread safe and provide a way to get your connections. I think 
the OPartitionedDatabasePoolFactory is only used if you want to create 
multiple OPartitionedDatabasePool instances.

Also, I think *ODatabaseRecordThreadLocal.INSTANCE.set(db) *is no longer 
used in 2.1, only *db.activateOnCurrentThread(). *
This is what I'm doing...

A static instance of OPartitionedDatabasePool:
*OPartitionedDatabasePool myPool = new OPartitionedDatabasePool(dbUrl, 
user, password);*

And then anytime a thread needs a connection:
*ODatabaseDocumentTx dbConnection = MyClass.myPool .acquire();*

That's it. The pool should automatically handle getting a database 
connection that will function on your thread. You should not have to worry 
about setting the "*ThreadLocal*" or activating on "*CurrentThread*".


On Monday, August 17, 2015 at 7:19:53 AM UTC-7, Sergey Dashko wrote:
>
> Hello.
> As I understand OPartitionedDatabasePoolFactory usage should be safe with 
> multiple threads.
> I've made static method with this code
>   var pool = new OPartitionedDatabasePoolFactory
>    return pool.get("remote:" + server + "/" + db,login,pass)
>
> Then in needed place I make acquire and then close.
> But still getting this exception.
> What wrong with it code. How it can be fixed?
> I use it in Play Framework
>

-- 

--- 
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.

Reply via email to