当前位置:网站首页>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.
边栏推荐
- ansible各个模块详解
- [WeChat applet] WXML template syntax - conditional rendering
- 人性的弱点
- How to quickly upgrade your Taobao account to a higher level
- 逆向理论知识4
- Basic properties of binary tree + oj problem analysis
- 【cesium】Load and locate 3D Tileset
- Flutter学习-开篇
- uboot enable debug printing information
- Flutter学习三-Flutter基本结构和原理
猜你喜欢

OFDM 十六讲 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems

Analyses the mainstream across technology solutions

upload上传图片到腾讯云,如何上传图片

Basic properties of binary tree + oj problem analysis

ESP32 485光照度

write the story about us
![[cesium] element highlighting](/img/99/504ca9802db83eb33bc6d91b34fa84.png)
[cesium] element highlighting

开发一套高容错分布式系统

server disk array

Structured Light 3D Reconstruction (2) Line Structured Light 3D Reconstruction
随机推荐
Requests the library deployment and common function
flex布局青蛙游戏通关攻略
Returned object not currently part of this pool
仪表板展示 | DataEase看中国:数据呈现中国资本市场
dedecms dream weaving tag tag does not support capital letters fix
Structured Light 3D Reconstruction (2) Line Structured Light 3D Reconstruction
jvm 三 之堆与栈
server disk array
Day019 Method overriding and introduction of related classes
[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)
u-boot in u-boot, dm-pre-reloc
Basic properties of binary tree + oj problem analysis
LAB 信号量实现细节
The solution to the failure to read channel information when dedecms generates a message in the background
延迟加载js方式async与defer区别
coppercam入门手册[6]
[cesium] 3D Tileset model is loaded and associated with the model tree
Flutter learning - the beginning
【Transfer】What is etcd
How to identify false evidence and evidence?