当前位置:网站首页>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.
边栏推荐
猜你喜欢

8.04 Day35-----MVC three-tier architecture
![[Surveying] Quick Summary - Excerpt from Gaoshu Gang](/img/35/e5c5349b8d4ccf9203c432a9aaee7b.png)
[Surveying] Quick Summary - Excerpt from Gaoshu Gang

【cesium】加载并定位 3D Tileset

基于Web的商城后台管理系统的设计与实现

类的底层机制

逆向理论知识4

Detailed explanation of each module of ansible

2022杭电多校第一场01

Excel画图

Visibility of multi-column attribute column elements: display, visibility, opacity, vertical alignment: vertical-align, z-index The larger it is, the more it will be displayed on the upper layer
随机推荐
【微信小程序】WXML模板语法-条件渲染
Redis哨兵模式配置文件详解
Excel画图
淘宝账号如何快速提升到更高等级
入口点注入
u-boot in u-boot, dm-pre-reloc
flex布局青蛙游戏通关攻略
Excel Paint
[WeChat applet] WXML template syntax - conditional rendering
使用二维码解决固定资产管理的难题
大学物理---质点运动学
After controlling the export file in MySQL, it becomes \N. Is there any solution?
dedecms dream weaving tag tag does not support capital letters fix
数字孪生技术在电力系统中的应用现状
Flutter 父子组件如何都能收到点击事件
for..in和for..of的区别
Basic properties of binary tree + oj problem analysis
Error creating bean with name ‘configDataContextRefresher‘ defined in class path resource
Flutter TapGestureRecognizer 如何工作
仪表板展示 | DataEase看中国:数据呈现中国资本市场