Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1123: rename JsonBufferRecyclers as JsonRecyclerPools #1124

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/fasterxml/jackson/core/JsonFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -2166,7 +2166,7 @@ public RecyclerPool<BufferRecycler> _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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/fasterxml/jackson/core/TSFBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @since 2.16
*/
public final class JsonBufferRecyclers
public final class JsonRecyclerPools
{
/**
* @return the default {@link RecyclerPool} implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down