Skip to content

Commit

Permalink
Merge branch '2.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 12, 2023
2 parents 0cfc787 + 4583784 commit 3303d15
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/main/java/tools/jackson/core/TSFBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Objects;

import tools.jackson.core.util.BufferRecycler;
import tools.jackson.core.util.JsonBufferRecyclers;
import tools.jackson.core.util.JsonRecyclerPools;
import tools.jackson.core.util.RecyclerPool;

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ public abstract class TSFBuilder<F extends TokenStreamFactory,
protected TSFBuilder(StreamReadConstraints src, StreamWriteConstraints swc,
ErrorReportConfiguration erc,
int formatReadF, int formatWriteF) {
this(JsonBufferRecyclers.defaultPool(),
this(JsonRecyclerPools.defaultPool(),
src, swc, erc,
TokenStreamFactory.DEFAULT_FACTORY_FEATURE_FLAGS,
TokenStreamFactory.DEFAULT_STREAM_READ_FEATURE_FLAGS,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/tools/jackson/core/TokenStreamFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import tools.jackson.core.sym.SimpleNameMatcher;
import tools.jackson.core.util.BufferRecycler;
import tools.jackson.core.util.JacksonFeature;
import tools.jackson.core.util.JsonBufferRecyclers;
import tools.jackson.core.util.JsonRecyclerPools;
import tools.jackson.core.util.Named;
import tools.jackson.core.util.RecyclerPool;
import tools.jackson.core.util.Snapshottable;
Expand Down Expand Up @@ -277,7 +277,7 @@ protected TokenStreamFactory(StreamReadConstraints src, StreamWriteConstraints s
_streamReadConstraints = Objects.requireNonNull(src);
_streamWriteConstraints = Objects.requireNonNull(swc);
_errorReportConfiguration = Objects.requireNonNull(erc);
_recyclerPool = JsonBufferRecyclers.defaultPool();
_recyclerPool = JsonRecyclerPools.defaultPool();
_factoryFeatures = DEFAULT_FACTORY_FEATURE_FLAGS;
_streamReadFeatures = DEFAULT_STREAM_READ_FEATURE_FLAGS;
_streamWriteFeatures = DEFAULT_STREAM_WRITE_FEATURE_FLAGS;
Expand Down Expand Up @@ -1237,7 +1237,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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* JSON-backed {@link JsonFactory} for recycling {@link BufferRecycler}
* containers.
*/
public final class JsonBufferRecyclers
public final class JsonRecyclerPools
{
/**
* @return the default {@link RecyclerPool} implementation
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/tools/jackson/core/util/TextBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -890,11 +890,9 @@ public char[] finishCurrentSegment() throws JacksonException {
* delimiter or end-of-line
* @param trimTrailingSpaces Whether trailing spaces should be trimmed or not
* @return token as text
* @throws IOException If length constraints (of longest allowed Text value) are violated
*
* @since 2.15
*/
public String finishAndReturn(int lastSegmentEnd, boolean trimTrailingSpaces) throws JacksonException
public String finishAndReturn(int lastSegmentEnd, boolean trimTrailingSpaces)
throws JacksonException
{
if (trimTrailingSpaces) {
// First, see if it's enough to trim end of current segment:
Expand Down
22 changes: 11 additions & 11 deletions src/test/java/tools/jackson/core/CoreJDKSerializabilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import tools.jackson.core.io.ContentReference;
import tools.jackson.core.json.JsonFactory;
import tools.jackson.core.util.DefaultPrettyPrinter;
import tools.jackson.core.util.JsonBufferRecyclers;
import tools.jackson.core.util.JsonRecyclerPools;
import tools.jackson.core.util.RecyclerPool;

/**
Expand Down Expand Up @@ -121,19 +121,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
12 changes: 6 additions & 6 deletions src/test/java/tools/jackson/core/io/BufferRecyclerPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@
import tools.jackson.core.json.JsonFactory;
import tools.jackson.core.json.JsonGeneratorBase;
import tools.jackson.core.util.BufferRecycler;
import tools.jackson.core.util.JsonBufferRecyclers;
import tools.jackson.core.util.JsonRecyclerPools;
import tools.jackson.core.util.RecyclerPool;

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

0 comments on commit 3303d15

Please sign in to comment.