Skip to content

Commit

Permalink
Jackson should use HybridJacksonPool
Browse files Browse the repository at this point in the history
  • Loading branch information
franz1981 committed Mar 28, 2024
1 parent b18f8d6 commit 982fdb8
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 982fdb8

Please sign in to comment.