当前位置:网站首页>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.
边栏推荐
- u-boot in u-boot, dm-pre-reloc
- 【软考 系统架构设计师】软件架构设计③ 特定领域软件架构(DSSA)
- ESP32 485光照度
- 人性的弱点
- 延迟加载js方式async与defer区别
- Understanding and use of C# on set() and get() methods
- Flutter学习-开篇
- Mvi架构浅析
- 重新审视分布式系统:永远不会有完美的一致性方案……
- Community Sharing|Tencent Overseas Games builds game security operation capabilities based on JumpServer
猜你喜欢
Application status of digital twin technology in power system
JeeSite New Report
Excel Paint
Dephi逆向工具Dede导出函数名MAP导入到IDA中
Flutter real machine running and simulator running
【cesium】Load and locate 3D Tileset
二叉树基本性质+oj题解析
Day019 方法重写与相关类的介绍
How to identify false evidence and evidence?
The underlying mechanism of the class
随机推荐
Mini Program_Dynamic setting of tabBar theme skin
Requests库部署与常用函数讲解
dedecms后台生成提示读取频道信息失败的解决方法
淘宝账号如何快速提升到更高等级
【cesium】加载并定位 3D Tileset
upload upload pictures to Tencent cloud, how to upload pictures
Redis哨兵模式配置文件详解
Flex layout frog game clearance strategy
Distributed systems revisited: there will never be a perfect consistency scheme...
大学物理---质点运动学
C语言-大白话理解原码,反码和补码
Flutter真机运行及模拟器运行
Redis - 13、开发规范
Flutter 父子组件如何都能收到点击事件
shell函数
dedecms dream weaving tag tag does not support capital letters fix
Flutter学习三-Flutter基本结构和原理
Qt制作18帧丘比特表白意中人、是你的丘比特嘛!!!
Flutter学习5-集成-打包-发布
基于Web的商城后台管理系统的设计与实现