当前位置:网站首页>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.
边栏推荐
- Flutter learning three-Flutter basic structure and principle
- 【转】什么是etcd
- Error creating bean with name ‘configDataContextRefresher‘ defined in class path resource
- 1068找到更多的硬币
- 软件管理rpm
- Mvi架构浅析
- Excel Paint
- University Physics---Particle Kinematics
- 【cesium】加载并定位 3D Tileset
- dedecms error The each() function is deprecated
猜你喜欢
随机推荐
What is ASEMI photovoltaic diode, the role of photovoltaic diode
一篇博客通关Redis技术栈
write the story about us
RL强化学习总结(一)
LeetCode:1403. 非递增顺序的最小子序列【贪心】
【cesium】元素高亮显示
[informix] Resolving startup errors and solutions
结构光三维重建(一)条纹结构光三维重建
Dephi逆向工具Dede导出函数名MAP导入到IDA中
逆向理论知识4
Structured light 3D reconstruction (1) Striped structured light 3D reconstruction
C语言-大白话理解原码,反码和补码
WPF中DataContext作用
【转】什么是etcd
The mall background management system based on Web design and implementation
Mini Program_Dynamic setting of tabBar theme skin
Multi-threaded query results, add List collection
Flex layout frog game clearance strategy
coppercam入门手册[6]
Qt制作18帧丘比特表白意中人、是你的丘比特嘛!!!






