Hi everyone~

Regarding multi-threading, I found that in this question 
<https://github.com/jOOQ/jOOQ/issues/7410>, lukaseder answered that *DSLContext 
*should be singleton assuming the SPI it uses is thread safe.

So, is the recommended approach to share one single *DSLContext *object 
across all threads? Does that mean that we are sharing one single database 
connection between threads as well?

If yes, I think it is not the best practice, as said in this stackoverflow 
question 
<https://stackoverflow.com/questions/1531073/is-java-sql-connection-thread-safe>,
 
that we should use a connections pool, instead of sharing one connection 
between threads.

So I am confused about how to use DSLContext in multi-threading.

Currently my company just creates one new *DSLContext *object for each 
thread, which is not aligned with the suggestion made by lukaseder in the 
question mentioned above.

Hope I can learn from more experience devs.

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/83e1056f-0b3f-441d-adf6-afc711e20701n%40googlegroups.com.

Reply via email to