当前位置:网站首页>Returned object not currently part of this pool
Returned object not currently part of this pool
2022-08-05 05:12:00 【gentleman jiejie】
Question background
Use the org.apache.commons.pool2 dependency to do some pooling operations, pool some clients that have been instantiated successfully into the object pool, and speed up the query efficiency of the interface through pooling.
Problem Analysis
The above exception is translated as [The returned object does not currently belong to this pool]. Why does this happen? Because the interface that causes this error report allows to receive multiple parameters, and then return the results together. In order to improve the query efficiency, soIntroduced multi-threaded query, and then each thread runs and executes the underlying logic method, there is a core logic that will go to the object pool to get the client object, if it can't get it, it will create the object pool and generate the client object and put it into the objectin the pool.Under normal circumstances, there is no such exception. The problem is that in the case of multi-threaded concurrency, if the bottom layer does not lock or something to ensure synchronization, then multiple object pools are likely to be created, but there is actually a reference relationship.It is the last generated object pool, so when some objects created earlier are returned to the pool, they will find that the object does not belong to the last referenced object pool, and will report [Returned object not currently part]of this pool] error.
Solution
1. If there is no idea of lazy loading, it is recommended to initialize the object pool when the project starts.
2. If you are afraid that some objects will not be used at all and will be initialized at the beginning, which will lead to waste of resources, it is recommended to try locking, but this will affect the overall query efficiency.
边栏推荐
- Distributed systems revisited: there will never be a perfect consistency scheme...
- MySQL Foundation (1) - Basic Cognition and Operation
- u-boot调试定位手段
- LAB Semaphore Implementation Details
- ansible各个模块详解
- WPF中DataContext作用
- 大学物理---质点运动学
- 【转】什么是etcd
- Analyses the mainstream across technology solutions
- Redis - 13. Development Specifications
猜你喜欢
结构光三维重建(一)条纹结构光三维重建
8.04 Day35-----MVC三层架构
8.04 Day35-----MVC three-tier architecture
How can Flutter parent and child components receive click events
Qt produces 18 frames of Cupid to express his love, is it your Cupid!!!
u-boot调试定位手段
Homework 8.4 Interprocess Communication Pipes and Signals
upload上传图片到腾讯云,如何上传图片
Error creating bean with name ‘configDataContextRefresher‘ defined in class path resource
for..in和for..of的区别
随机推荐
1068找到更多的硬币
Use IDEA to connect to TDengine server
ansible各个模块详解
How to quickly upgrade your Taobao account to a higher level
After controlling the export file in MySQL, it becomes \N. Is there any solution?
Requests the library deployment and common function
Flex layout frog game clearance strategy
Day019 Method overriding and introduction of related classes
Mvi架构浅析
RL强化学习总结(一)
Please write the SparkSQL statement
The underlying mechanism of the class
【cesium】加载并定位 3D Tileset
Flutter learning three-Flutter basic structure and principle
RL reinforcement learning summary (1)
MySQL中控制导出文件后变为了\N有什么解决方案吗?
Multi-threaded query results, add List collection
How to deal with DNS hijacking?
数字孪生技术在电力系统中的应用现状
Flutter学习5-集成-打包-发布