java - 用了ThreadLocal,Connection对象是不是只有一个?
高洛峰
高洛峰 2017-04-18 09:51:53
0
2
395

用了ThreadLocal,connection对象是不是只有一个?

每个线程的threadLocals中保存的都是connection对象的副本?

这样的理解是正确的么?

connection对象可以共用么?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
巴扎黑

With ThreadLocal connection, it is not the same.
Every thread keeps a copy of itself.
Connection objects are generally used by a single thread. No concurrent calls across threads.

Ty80

"Each thread keeps a copy of itself", why not use a connection pool to manage it?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!