Skip to content

Commit

Permalink
Merge branch '2.17' into 2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 20, 2024
2 parents 4d50286 + 2a4a6dc commit 7c64d87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Expand Up @@ -29,6 +29,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
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
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

0 comments on commit 7c64d87

Please sign in to comment.