From 45837840cd35c1681f0a05fbdc046ec264006aaf Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 11 Oct 2023 19:53:08 -0700 Subject: [PATCH] Fix #1123: rename `JsonBufferRecyclers` as `JsonRecyclerPools` (#1124) --- .../fasterxml/jackson/core/JsonFactory.java | 4 ++-- .../fasterxml/jackson/core/TSFBuilder.java | 4 ++-- ...rRecyclers.java => JsonRecyclerPools.java} | 2 +- .../jackson/core/TestJDKSerializability.java | 22 +++++++++---------- .../core/io/BufferRecyclerPoolTest.java | 12 +++++----- 5 files changed, 22 insertions(+), 22 deletions(-) rename src/main/java/com/fasterxml/jackson/core/util/{JsonBufferRecyclers.java => JsonRecyclerPools.java} (99%) diff --git a/src/main/java/com/fasterxml/jackson/core/JsonFactory.java b/src/main/java/com/fasterxml/jackson/core/JsonFactory.java index 90d066d755..390f0eb650 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonFactory.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonFactory.java @@ -368,7 +368,7 @@ public static int collectDefaults() { public JsonFactory() { this((ObjectCodec) null); } public JsonFactory(ObjectCodec oc) { - _recyclerPool = JsonBufferRecyclers.defaultPool(); + _recyclerPool = JsonRecyclerPools.defaultPool(); _objectCodec = oc; _quoteChar = DEFAULT_QUOTE_CHAR; _streamReadConstraints = StreamReadConstraints.defaults(); @@ -2166,7 +2166,7 @@ public RecyclerPool _getRecyclerPool() { // scheme, for cases where it is considered harmful (possibly // on Android, for example) if (!Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING.enabledIn(_factoryFeatures)) { - return JsonBufferRecyclers.nonRecyclingPool(); + return JsonRecyclerPools.nonRecyclingPool(); } return _recyclerPool; } diff --git a/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java b/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java index 4a73a9f0cf..63a4589160 100644 --- a/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java +++ b/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.core.json.JsonWriteFeature; import com.fasterxml.jackson.core.util.BufferRecycler; import com.fasterxml.jackson.core.util.RecyclerPool; -import com.fasterxml.jackson.core.util.JsonBufferRecyclers; +import com.fasterxml.jackson.core.util.JsonRecyclerPools; import com.fasterxml.jackson.core.util.JsonGeneratorDecorator; /** @@ -143,7 +143,7 @@ protected TSFBuilder(JsonFactory base) protected TSFBuilder(int factoryFeatures, int parserFeatures, int generatorFeatures) { - _recyclerPool = JsonBufferRecyclers.defaultPool(); + _recyclerPool = JsonRecyclerPools.defaultPool(); _factoryFeatures = factoryFeatures; _streamReadFeatures = parserFeatures; diff --git a/src/main/java/com/fasterxml/jackson/core/util/JsonBufferRecyclers.java b/src/main/java/com/fasterxml/jackson/core/util/JsonRecyclerPools.java similarity index 99% rename from src/main/java/com/fasterxml/jackson/core/util/JsonBufferRecyclers.java rename to src/main/java/com/fasterxml/jackson/core/util/JsonRecyclerPools.java index 06311d960e..55f5115d3f 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JsonBufferRecyclers.java +++ b/src/main/java/com/fasterxml/jackson/core/util/JsonRecyclerPools.java @@ -15,7 +15,7 @@ * * @since 2.16 */ -public final class JsonBufferRecyclers +public final class JsonRecyclerPools { /** * @return the default {@link RecyclerPool} implementation diff --git a/src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java b/src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java index 293d06f21b..dacd8f19f3 100644 --- a/src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java +++ b/src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.util.RecyclerPool; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; -import com.fasterxml.jackson.core.util.JsonBufferRecyclers; +import com.fasterxml.jackson.core.util.JsonRecyclerPools; /** * Unit tests for [core#31] (https://github.com/FasterXML/jackson-core/issues/31) @@ -117,19 +117,19 @@ public void testRecyclerPools() throws Exception { // First: shared/global pools that will always remain/become globally // shared instances - _testRecyclerPoolGlobal(JsonBufferRecyclers.nonRecyclingPool()); - _testRecyclerPoolGlobal(JsonBufferRecyclers.threadLocalPool()); + _testRecyclerPoolGlobal(JsonRecyclerPools.nonRecyclingPool()); + _testRecyclerPoolGlobal(JsonRecyclerPools.threadLocalPool()); - _testRecyclerPoolGlobal(JsonBufferRecyclers.sharedConcurrentDequePool()); - _testRecyclerPoolGlobal(JsonBufferRecyclers.sharedLockFreePool()); - JsonBufferRecyclers.BoundedPool bounded = (JsonBufferRecyclers.BoundedPool) - _testRecyclerPoolGlobal(JsonBufferRecyclers.sharedBoundedPool()); + _testRecyclerPoolGlobal(JsonRecyclerPools.sharedConcurrentDequePool()); + _testRecyclerPoolGlobal(JsonRecyclerPools.sharedLockFreePool()); + JsonRecyclerPools.BoundedPool bounded = (JsonRecyclerPools.BoundedPool) + _testRecyclerPoolGlobal(JsonRecyclerPools.sharedBoundedPool()); assertEquals(RecyclerPool.BoundedPoolBase.DEFAULT_CAPACITY, bounded.capacity()); - _testRecyclerPoolNonShared(JsonBufferRecyclers.newConcurrentDequePool()); - _testRecyclerPoolNonShared(JsonBufferRecyclers.newLockFreePool()); - bounded = (JsonBufferRecyclers.BoundedPool) - _testRecyclerPoolNonShared(JsonBufferRecyclers.newBoundedPool(250)); + _testRecyclerPoolNonShared(JsonRecyclerPools.newConcurrentDequePool()); + _testRecyclerPoolNonShared(JsonRecyclerPools.newLockFreePool()); + bounded = (JsonRecyclerPools.BoundedPool) + _testRecyclerPoolNonShared(JsonRecyclerPools.newBoundedPool(250)); assertEquals(250, bounded.capacity()); } diff --git a/src/test/java/com/fasterxml/jackson/core/io/BufferRecyclerPoolTest.java b/src/test/java/com/fasterxml/jackson/core/io/BufferRecyclerPoolTest.java index 1b78968b88..2b3bf8bade 100644 --- a/src/test/java/com/fasterxml/jackson/core/io/BufferRecyclerPoolTest.java +++ b/src/test/java/com/fasterxml/jackson/core/io/BufferRecyclerPoolTest.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.core.json.JsonGeneratorImpl; import com.fasterxml.jackson.core.util.BufferRecycler; import com.fasterxml.jackson.core.util.RecyclerPool; -import com.fasterxml.jackson.core.util.JsonBufferRecyclers; +import com.fasterxml.jackson.core.util.JsonRecyclerPools; import java.io.IOException; import java.io.OutputStream; @@ -15,23 +15,23 @@ public class BufferRecyclerPoolTest extends BaseTest { public void testNoOp() throws Exception { // no-op pool doesn't actually pool anything, so avoid checking it - checkBufferRecyclerPoolImpl(JsonBufferRecyclers.nonRecyclingPool(), false); + checkBufferRecyclerPoolImpl(JsonRecyclerPools.nonRecyclingPool(), false); } public void testThreadLocal() throws Exception { - checkBufferRecyclerPoolImpl(JsonBufferRecyclers.threadLocalPool(), true); + checkBufferRecyclerPoolImpl(JsonRecyclerPools.threadLocalPool(), true); } public void testLockFree() throws Exception { - checkBufferRecyclerPoolImpl(JsonBufferRecyclers.newLockFreePool(), true); + checkBufferRecyclerPoolImpl(JsonRecyclerPools.newLockFreePool(), true); } public void testConcurrentDequeue() throws Exception { - checkBufferRecyclerPoolImpl(JsonBufferRecyclers.newConcurrentDequePool(), true); + checkBufferRecyclerPoolImpl(JsonRecyclerPools.newConcurrentDequePool(), true); } public void testBounded() throws Exception { - checkBufferRecyclerPoolImpl(JsonBufferRecyclers.newBoundedPool(1), true); + checkBufferRecyclerPoolImpl(JsonRecyclerPools.newBoundedPool(1), true); } public void testPluggingPool() throws Exception {