Are Spring Data MongoDB connections thread bounded?

315 Views Asked by At

We are evaluating TokuMX so we could use its ACID transaction feature, but we want to use it with Spring Data for MongoDB.

So, here is the question: are MongoDB connections managed by Spring Data thread bounded so that we could take advantage of TokuMX transaction implementation?

1

There are 1 best solutions below

0
On

According to this:

http://docs.mongodb.org/ecosystem/drivers/java-concurrency/#java-driver-concurrency

It looks like connections are pulled from an internal connection pool and returned "per request" so there is no database connection tied to a thread.

I haven't found a way to override this yet. Perhaps there is another driver out there, or a setting I haven't found yet.

Edit: Apparently I didn't read the article far enough. You should be able to use db.requestStart() to ensure the connection is keep for the thread.

There's a similar mention for C# and Python here:

http://docs.tokutek.com/tokumx/tokumx-transactions.html#tokumx-transactions-multi-statement-drivers