Skip to content

Commit 52b7e89

Browse files
mariofuscovietj
authored andcommitted
fix resource acquisition in hybrid pool with native threads
1 parent 8fcd7b4 commit 52b7e89

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/io/vertx/core/json/jackson/HybridJacksonPool.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ public BufferRecycler acquirePooled() {
5858
nativePool.acquirePooled();
5959
}
6060

61+
@Override
62+
public BufferRecycler acquireAndLinkPooled() {
63+
// when using the ThreadLocal based pool it is not necessary to register the BufferRecycler on the pool
64+
return isVirtual.test(Thread.currentThread()) ?
65+
VirtualPoolHolder.virtualPool.acquireAndLinkPooled() :
66+
nativePool.acquirePooled();
67+
}
68+
6169
@Override
6270
public void releasePooled(BufferRecycler bufferRecycler) {
6371
if (bufferRecycler instanceof VThreadBufferRecycler) {

0 commit comments

Comments
 (0)