Skip to content

Commit

Permalink
Jackson should use HybridJacksonPool
Browse files Browse the repository at this point in the history
(cherry picked from commit 982fdb8)
  • Loading branch information
franz1981 authored and gsmet committed Apr 9, 2024
1 parent c40968f commit 257c5a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.quarkus.jackson.deployment;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

import com.fasterxml.jackson.core.util.JsonRecyclerPools;

public class JacksonDefaultPoolTest {

@Test
public void validateDefaultJacksonPool() {
Assertions.assertThat(JsonRecyclerPools.defaultPool()).isInstanceOf(JsonRecyclerPools.LockFreePool.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public class VertxHybridPoolObjectMapperCustomizer implements ObjectMapperCustom

@Override
public void customize(ObjectMapper objectMapper) {
if (objectMapper.getFactory()._getRecyclerPool() == JsonRecyclerPools.defaultPool()) {
var existingMapperPool = objectMapper.getFactory()._getRecyclerPool();
// JsonRecyclerPools.defaultPool() by default should create a LockFreePool
if (existingMapperPool instanceof JsonRecyclerPools.LockFreePool) {
objectMapper.getFactory().setRecyclerPool(HybridJacksonPool.getInstance());
}
}
Expand Down

0 comments on commit 257c5a9

Please sign in to comment.