Skip to content
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
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ a pure JSON library.

#1241: Fix `NumberInput.looksLikeValidNumber()` implementation
(contributed by @pjfanning)
#1256: Revert #1117: change default recycler pool back to `threadLocalPool()`
for 2.17.1

2.17.0 (12-Mar-2024)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ public final class JsonRecyclerPools
{
/**
* Method to call to get the default recycler pool instance:
* as of Jackson 2.17 this is same as calling
* {@link #newLockFreePool()}; earlier
* as of Jackson 2.17.x and earlier (except for 2.17.0) this is same as calling
* {@link #threadLocalPool()} -- 2.17.0 temporarily had this call
* {@link #newLockFreePool()} (but reverted due to problems reported).
* Will likely be changed in 2.18.0 to something else.
*
* @return the default {@link RecyclerPool} implementation to use
* if no specific implementation desired.
*/
public static RecyclerPool<BufferRecycler> defaultPool() {
return newLockFreePool();
return threadLocalPool();
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/perf/RecyclerPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
public class RecyclerPoolTest
{
final static int THREAD_COUNT = 100;
final static int THREAD_COUNT = 200;

final static int RUNTIME_SECS = 60;

Expand Down Expand Up @@ -100,7 +100,8 @@ void testUntil(JsonFactory jsonF,
long endTimeMsecs, int threadId, AtomicLong calls)
{
final Random rnd = new Random(threadId);
final byte[] JSON_INPUT = "\"abc\"".getBytes(StandardCharsets.UTF_8);
final byte[] JSON_INPUT = "42 "
.getBytes(StandardCharsets.UTF_8);

while (System.currentTimeMillis() < endTimeMsecs) {
try {
Expand Down Expand Up @@ -144,7 +145,6 @@ private void _testWrite(JsonFactory jsonF) throws Exception
StringWriter w = new StringWriter(16);
JsonGenerator g = jsonF.createGenerator(w);
g.writeStartArray();
g.writeString("foobar");
g.writeEndArray();
g.close();
}
Expand All @@ -154,15 +154,15 @@ public static void main(String[] args) throws Exception
RecyclerPoolTest test = new RecyclerPoolTest(THREAD_COUNT);
List<String> results = Arrays.asList(
test.testPool(JsonFactory.builder()
.recyclerPool(JsonRecyclerPools.newConcurrentDequePool())
.recyclerPool(JsonRecyclerPools.newLockFreePool())
.build(),
RUNTIME_SECS),
RUNTIME_SECS * 1000),
test.testPool(JsonFactory.builder()
.recyclerPool(JsonRecyclerPools.newBoundedPool(THREAD_COUNT - 5))
.recyclerPool(JsonRecyclerPools.newConcurrentDequePool())
.build(),
RUNTIME_SECS),
test.testPool(JsonFactory.builder()
.recyclerPool(JsonRecyclerPools.newLockFreePool())
.recyclerPool(JsonRecyclerPools.newBoundedPool(THREAD_COUNT - 5))
.build(),
RUNTIME_SECS)
);
Expand Down