From bcaa6542118c3ae71b6fb8c2ea3e51756eabe126 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 9 Nov 2024 21:00:46 +0100 Subject: [PATCH] non-recycling pool in Jackson (#58) --- pekko-http-jackson/src/main/resources/reference.conf | 4 ++-- .../github/pjfanning/pekkohttpjackson/JacksonSupport.scala | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pekko-http-jackson/src/main/resources/reference.conf b/pekko-http-jackson/src/main/resources/reference.conf index 7d9f34b..7164319 100644 --- a/pekko-http-jackson/src/main/resources/reference.conf +++ b/pekko-http-jackson/src/main/resources/reference.conf @@ -30,8 +30,8 @@ pekko-http-json { # https://javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.0/com/fasterxml/jackson/core/util/JsonRecyclerPools.html # The default is "thread-local" which is the same as the default in Jackson 2.16. buffer-recycler { - # the supported values are "thread-local", "lock-free", "shared-lock-free", "concurrent-deque", - # "shared-concurrent-deque", "bounded" + # the supported values are "thread-local", "concurrent-deque", "shared-concurrent-deque", "bounded", "non-recycling" + # "lock-free", "shared-lock-free" are supported but not recommended as they are due for removal in Jackson pool-instance = "thread-local" # the maximum size of bounded recycler pools - must be >=1 or an IllegalArgumentException will occur # only applies to pool-instance type "bounded" diff --git a/pekko-http-jackson/src/main/scala/com/github/pjfanning/pekkohttpjackson/JacksonSupport.scala b/pekko-http-jackson/src/main/scala/com/github/pjfanning/pekkohttpjackson/JacksonSupport.scala index 6dd6827..42657ba 100644 --- a/pekko-http-jackson/src/main/scala/com/github/pjfanning/pekkohttpjackson/JacksonSupport.scala +++ b/pekko-http-jackson/src/main/scala/com/github/pjfanning/pekkohttpjackson/JacksonSupport.scala @@ -100,6 +100,7 @@ object JacksonSupport extends JacksonSupport { case "shared-concurrent-deque" => JsonRecyclerPools.sharedConcurrentDequePool() case "bounded" => JsonRecyclerPools.newBoundedPool(cfg.getInt("buffer-recycler.bounded-pool-size")) + case "non-recycling" => JsonRecyclerPools.nonRecyclingPool() case other => throw new IllegalArgumentException(s"Unknown recycler-pool: $other") }