Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can session from pool.getSession be shared in multi-threading #328

Closed
wolaiye1010 opened this issue Jul 16, 2021 · 1 comment
Closed

can session from pool.getSession be shared in multi-threading #328

wolaiye1010 opened this issue Jul 16, 2021 · 1 comment

Comments

@wolaiye1010
Copy link

现在每次query 的时候
pool.getSession
使用
session.release();

但发现getSession 每次都耗时3ms 耗时挺多的,想质询下,这个getSession 是否可以做成静态变量多个线程公用,而不用每次都获取使用完释放呢

@wey-gu
Copy link
Contributor

wey-gu commented Jul 16, 2021

Dear @wolaiye1010

It's not allowed to be used by multiple processes, thus you can create different pools per process.
Also, don't have to release it for all cases, you can maintain it yourself if release is too costly in your use case.

You can refer to #322

@klay-ke klay-ke changed the title pool.getSession 取出的session 多个线程是否可以公用呢? can session from pool.getSession be shared in multi-threading Sep 28, 2021
@klay-ke klay-ke closed this as completed Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants